Commit e298bb4a authored by Ilya Simonov's avatar Ilya Simonov

fix admin video categories

parent 2af17265
from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline
from . import models
from . import models, forms
class TagAdmin(admin.ModelAdmin):
......@@ -24,8 +24,24 @@ class TagInline(GenericTabularInline):
class VideoAdmin(admin.ModelAdmin):
form = forms.VideoForm
fields = [
'title',
'slug',
'status',
'description',
'local_file',
's3_file',
'thumbnail',
'duration',
'creator',
'closed_captions',
'categories',
'created',
'updated'
]
list_display = ['id', 'title', 'slug', 'status', 'duration']
readonly_fields = ['created', 'updated']
readonly_fields = ['s3_file', 'created', 'updated']
list_filter = ('status',)
inlines = [TagInline]
......
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.forms import ModelForm
from .models import Video
class VideoForm(ModelForm):
class Meta:
model = Video
fields = '__all__'
widgets = {
'categories': FilteredSelectMultiple('Verbose name', False),
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment