27 lines
572 B
Python
27 lines
572 B
Python
|
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):
|
||
|
list_display = ['name', 'vendor', 'device', 'release_date']
|
||
|
fields = [
|
||
|
'name',
|
||
|
'slug',
|
||
|
'vendor',
|
||
|
'device',
|
||
|
'release_date',
|
||
|
'source_url',
|
||
|
'binary_url',
|
||
|
'description',
|
||
|
]
|
||
|
inlines = [CommentInline]
|
||
|
prepopulated_fields = {'slug': ['name']}
|