admin
This commit is contained in:
parent
8beaf10fb4
commit
d8117559c2
5 changed files with 43 additions and 23 deletions
|
@ -3,19 +3,24 @@
|
|||
|
||||
from django.contrib import admin
|
||||
|
||||
#from forms import FileAdminForm, ItemAdminForm, ArchiveFileAdminForm
|
||||
from forms import FileAdminForm, InstanceAdminForm
|
||||
import models
|
||||
|
||||
class FileAdmin(admin.ModelAdmin):
|
||||
search_fields = ['name', 'video_codec']
|
||||
list_display = ['available', 'is_main', '__unicode__', 'itemId']
|
||||
list_display_links = ('__unicode__', )
|
||||
|
||||
#form = FileAdminForm
|
||||
def itemId(self, obj):
|
||||
return '%s'%(obj.item.itemId)
|
||||
|
||||
form = FileAdminForm
|
||||
|
||||
admin.site.register(models.File, FileAdmin)
|
||||
|
||||
class InstanceAdmin(admin.ModelAdmin):
|
||||
search_fields = ['name', 'folder', 'volume__name']
|
||||
#form = ArchiveFileAdminForm
|
||||
form = InstanceAdminForm
|
||||
|
||||
admin.site.register(models.Instance, InstanceAdmin)
|
||||
|
||||
|
|
31
pandora/archive/forms.py
Normal file
31
pandora/archive/forms.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
from ajax_filtered_fields.forms import AjaxManyToManyField, ForeignKeyByLetter
|
||||
from django.conf import settings
|
||||
from django import forms
|
||||
|
||||
import models
|
||||
|
||||
ajax_filtered_js = (
|
||||
settings.ADMIN_MEDIA_PREFIX + "js/SelectBox.js",
|
||||
settings.ADMIN_MEDIA_PREFIX + "js/SelectFilter2.js",
|
||||
settings.STATIC_URL + 'js/jquery/jquery.js',
|
||||
settings.STATIC_URL + 'js/ajax_filtered_fields.js',
|
||||
)
|
||||
class FileAdminForm(forms.ModelForm):
|
||||
item = ForeignKeyByLetter(models.Item, field_name='itemId')
|
||||
|
||||
class Meta:
|
||||
model = models.File
|
||||
|
||||
class Media:
|
||||
js = ajax_filtered_js
|
||||
|
||||
|
||||
class InstanceAdminForm(forms.ModelForm):
|
||||
file = ForeignKeyByLetter(models.File, field_name='name')
|
||||
|
||||
class Meta:
|
||||
model = models.Instance
|
||||
|
||||
class Media:
|
||||
js = ajax_filtered_js
|
||||
|
|
@ -7,6 +7,9 @@ import models
|
|||
|
||||
class ItemAdmin(admin.ModelAdmin):
|
||||
search_fields = ['itemId', 'data', 'external_data']
|
||||
list_display = ['available', 'itemId', '__unicode__']
|
||||
list_display_links = ('__unicode__', )
|
||||
|
||||
admin.site.register(models.Item, ItemAdmin)
|
||||
|
||||
class PropertyAdmin(admin.ModelAdmin):
|
||||
|
|
|
@ -11,25 +11,6 @@ ajax_filtered_js = (
|
|||
settings.STATIC_URL + 'js/ajax_filtered_fields.js',
|
||||
)
|
||||
"""
|
||||
class FileAdminForm(forms.ModelForm):
|
||||
item = ForeignKeyByLetter(models.Item, field_name='imdb__title')
|
||||
|
||||
class Meta:
|
||||
model = models.File
|
||||
|
||||
class Media:
|
||||
js = ajax_filtered_js
|
||||
|
||||
class ArchiveFileAdminForm(forms.ModelForm):
|
||||
file = ForeignKeyByLetter(models.File, field_name='path')
|
||||
|
||||
class Meta:
|
||||
model = models.ArchiveFile
|
||||
|
||||
class Media:
|
||||
js = ajax_filtered_js
|
||||
|
||||
|
||||
class ItemAdminForm(forms.ModelForm):
|
||||
imdb = ForeignKeyByLetter(models.ItemImdb, field_name='title')
|
||||
oxdb = ForeignKeyByLetter(models.ItemOxdb, field_name='title')
|
||||
|
|
|
@ -823,7 +823,7 @@ class ItemSort(models.Model):
|
|||
aspectratio = models.IntegerField('Aspect Ratio', blank=True, db_index=True)
|
||||
bitrate = models.IntegerField(blank=True, db_index=True)
|
||||
pixels = models.BigIntegerField(blank=True, db_index=True)
|
||||
filename = models.IntegerField(blank=True, db_index=True)
|
||||
filename = models.CharField(max_length=1024, blank=True, db_index=True)
|
||||
files = models.IntegerField(blank=True, db_index=True)
|
||||
size = models.BigIntegerField(blank=True, db_index=True)
|
||||
|
||||
|
|
Loading…
Reference in a new issue