cablegates/pandora/archive/forms.py

35 lines
793 B
Python
Raw Normal View History

2011-01-01 11:44:42 +00:00
from ajax_filtered_fields.forms import ForeignKeyByLetter
2010-12-23 07:55:44 +00:00
from django.conf import settings
from django import forms
import models
2011-09-04 18:42:05 +00:00
from item.models import Item
2010-12-23 07:55:44 +00:00
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',
)
2011-01-01 11:44:42 +00:00
2010-12-23 07:55:44 +00:00
class FileAdminForm(forms.ModelForm):
2011-09-04 18:42:05 +00:00
item = ForeignKeyByLetter(Item, field_name='itemId')
2010-12-23 07:55:44 +00:00
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