2009-12-31 15:04:32 +00:00
|
|
|
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',
|
|
|
|
)
|
2010-07-12 14:56:14 +00:00
|
|
|
"""
|
2009-12-31 15:04:32 +00:00
|
|
|
class FileAdminForm(forms.ModelForm):
|
2010-09-23 16:01:48 +00:00
|
|
|
item = ForeignKeyByLetter(models.Item, field_name='imdb__title')
|
2009-12-31 15:04:32 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2010-09-23 16:01:48 +00:00
|
|
|
class ItemAdminForm(forms.ModelForm):
|
|
|
|
imdb = ForeignKeyByLetter(models.ItemImdb, field_name='title')
|
|
|
|
oxdb = ForeignKeyByLetter(models.ItemOxdb, field_name='title')
|
2009-12-31 15:04:32 +00:00
|
|
|
|
|
|
|
class Meta:
|
2010-09-23 16:01:48 +00:00
|
|
|
model = models.Item
|
2009-12-31 15:04:32 +00:00
|
|
|
|
|
|
|
class Media:
|
|
|
|
js = ajax_filtered_js
|
2010-07-12 14:56:14 +00:00
|
|
|
"""
|