2023-10-24 12:55:14 +00:00
|
|
|
from django.contrib import admin
|
|
|
|
|
|
|
|
from .models import Candidate, Comment
|
|
|
|
|
|
|
|
|
|
|
|
class CommentInline(admin.TabularInline):
|
|
|
|
model = Comment
|
|
|
|
fields = ['user', 'message']
|
|
|
|
extra = 0
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(Candidate)
|
|
|
|
class CandidateAdmin(admin.ModelAdmin):
|
2023-10-30 22:31:28 +00:00
|
|
|
list_display = ['name', 'vendor', 'device', 'release_date', 'ordering']
|
|
|
|
list_editable = ['ordering']
|
2023-10-24 12:55:14 +00:00
|
|
|
fields = [
|
|
|
|
'name',
|
|
|
|
'slug',
|
|
|
|
'vendor',
|
|
|
|
'device',
|
|
|
|
'release_date',
|
|
|
|
'source_url',
|
|
|
|
'binary_url',
|
|
|
|
'description',
|
|
|
|
]
|
|
|
|
inlines = [CommentInline]
|
|
|
|
prepopulated_fields = {'slug': ['name']}
|