https://docs.djangoproject.com/en/1.4/ref/contrib/admin/#adding-custom-validation-to-the-admin
Essentially, make a ModelForm exactly as you would normally, and add
logic to it.
You're going to want to change the queryset of the field(s) in question.
For example:
class ThingAdminForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(ThingAdminForm, self).__init__(*args, **kwargs)
if self.instance:
self.fields['whatever'].queryset =
self.fields['whatever'].queryset.filter(something=something_else)
class Meta:
model = ThingForm
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.