61 lines
2.0 KiB
Python
61 lines
2.0 KiB
Python
from django.contrib import admin
|
|
from .models import *
|
|
|
|
|
|
class ProgrammerAdmin(admin.ModelAdmin):
|
|
list_display = ('id', 'title', 'time_create', 'photo', 'is_published')
|
|
list_display_links = ('id', 'title')
|
|
search_fields = ('title', 'content')
|
|
list_editable = ('is_published',)
|
|
list_filter = ('time_create', 'is_published')
|
|
|
|
|
|
class RecallAdmin(admin.ModelAdmin):
|
|
list_display = ('id', 'title', 'time_create', 'scan', 'is_published')
|
|
list_display_links = ('id', 'title')
|
|
search_fields = ('title', 'content')
|
|
list_editable = ('is_published',)
|
|
list_filter = ('time_create', 'is_published')
|
|
|
|
|
|
class SolutionAdmin(admin.ModelAdmin):
|
|
list_display = ('id', 'title', 'time_create', 'is_published')
|
|
list_display_links = ('id', 'title')
|
|
search_fields = ('title', 'description', 'implementation')
|
|
list_editable = ('is_published',)
|
|
list_filter = ('time_create', 'is_published')
|
|
|
|
|
|
class HomeAdmin(admin.ModelAdmin):
|
|
list_display = ('id', 'title', 'time_create', 'is_published')
|
|
list_display_links = ('id', 'title')
|
|
search_fields = ('title', 'content')
|
|
list_editable = ('is_published',)
|
|
list_filter = ('time_create', 'is_published')
|
|
|
|
|
|
@admin.register(CallbackRequest)
|
|
class CallbackAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'phone', 'email', 'time_create', 'is_processed')
|
|
list_display_links = ('name', 'phone')
|
|
list_editable = ('is_processed',)
|
|
list_filter = ('time_create', 'is_processed')
|
|
search_fields = ('name', 'phone', 'email')
|
|
readonly_fields = ('time_create',)
|
|
|
|
|
|
@admin.register(PageView)
|
|
class PageViewAdmin(admin.ModelAdmin):
|
|
list_display = ['url', 'timestamp', 'ip_address']
|
|
list_filter = ['timestamp', 'url']
|
|
search_fields = ['url', 'ip_address']
|
|
date_hierarchy = 'timestamp'
|
|
|
|
def get_queryset(self, request):
|
|
return super().get_queryset(request).order_by('-timestamp')
|
|
|
|
admin.site.register(Competence, ProgrammerAdmin)
|
|
admin.site.register(Recall, RecallAdmin)
|
|
admin.site.register(Solution, SolutionAdmin)
|
|
admin.site.register(Home, HomeAdmin)
|