On Thu, 2007-07-12 at 19:55 +0000, kevinski wrote: > Here is my situation: > > I have a model attribute which needs CHOICES to come from another > model. The caveat is, I need to add an addition choice so I cannot set > it as a foreign key.
What do you mean here? I don't understand what an "addition choice" is. > How do I set the CHOICES to populate dynamically > and add the additional choice. You can't do this directly, since automatic alternative population either comes from the choices attribute (which is computed once) or by looking up a foreign key. What you can do, however, is construct the form field yourself (for form entry) and insert the choices manually. Right at the moment, for admin usage, that is probably a bit painful. For newforms-admin, though, it shouldn't be too hard, since you can subclass the Field and override the default form field method. Have a read of the code to see how this is used (look at formfield() in django/db/models/fields/__init__.py and django/contrib/admin/ in the newforms-admin branch). Regards, Malcolm -- I don't have a solution, but I admire your problem. http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---