28 lines
827 B
Python
28 lines
827 B
Python
from django.contrib import admin
|
|
from django.utils.translation import gettext_lazy as _
|
|
from .models import BrowsingHistory
|
|
|
|
|
|
@admin.register(BrowsingHistory)
|
|
class BrowsingHistoryAdmin(admin.ModelAdmin):
|
|
list_display = ['id', 'user', 'type', 'title', 'category', 'viewed_at']
|
|
list_filter = ['type', 'category', 'viewed_at']
|
|
search_fields = ['title', 'description', 'user__username']
|
|
ordering = ['-viewed_at']
|
|
date_hierarchy = 'viewed_at'
|
|
list_per_page = 50
|
|
|
|
fieldsets = (
|
|
(_('Basic Information'), {
|
|
'fields': ('user', 'type', 'title')
|
|
}),
|
|
(_('Detailed Information'), {
|
|
'fields': ('description', 'image', 'category', 'link')
|
|
}),
|
|
(_('Time'), {
|
|
'fields': ('viewed_at',)
|
|
}),
|
|
)
|
|
|
|
readonly_fields = ['viewed_at']
|