I found this ticket:
http://code.djangoproject.com/ticket/2445

It's not seen much activity for a while, but in september jkocherhans
posted some news which I found interesting. So since I needed this
functionality, I wrote a patch for it.

The patch is still shaky on edit_inline objects, but it works for
normal models. I'm working on getting it to work on edit_inlines too
(somehow hehe).


Basically the idea is that you can define:
def choices_for__FIELD(self):
     return ModelClass.objects.filter(relation_name=self.relation)

This function will be called when it is time to display or otherwise
fetch the choices for this particular row.
The patch also allows you to use normal QuerySets with the choices=
attribute for a any field (so you don't need to use the function if
the choices are more or less static).

Basically this eliminates the need for limit_choices_to alltogether
and allows for much more advanced functionality for the admin and
model-based forms.

The nice part is that the patch is perhaps 10 lines of code, and does
not break any existing model definitions.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to