19 lines
773 B
Python
19 lines
773 B
Python
from django.contrib import admin
|
|
from .models import Publication, Rating
|
|
|
|
# Register your models here.
|
|
class PublicationAdmin(admin.ModelAdmin):
|
|
list_display = ('pk', 'content_type', 'is_pinned', 'user', 'time_created', 'time_updated')
|
|
list_display_links = ('pk', 'content_type')
|
|
list_filter = ('content_type', 'is_pinned')
|
|
readonly_fields = ('time_created', 'time_updated')
|
|
ordering = ('-is_pinned', '-time_created')
|
|
search_fields = ('user__username', )
|
|
|
|
class RatingAdmin(admin.ModelAdmin):
|
|
list_display = ('publication', 'score', 'user', 'time_created')
|
|
readonly_fields = ('time_created', 'time_updated')
|
|
search_fields = ('user__username', )
|
|
|
|
admin.site.register(Publication, PublicationAdmin)
|
|
admin.site.register(Rating, RatingAdmin) |