I think this might be useful: http://www.zoia.org/blog/2007/04/23/using-dynamic-choices-with-django-newforms-and-custom-widgets/
On Fri, Oct 31, 2008 at 5:36 AM, webcomm <[EMAIL PROTECTED]> wrote: > > Bump. > > There must be a way to do this, right? I have looked all over... the > documentation seems to indicate that there is no way to do this in > django, which is surprising, since this is a necessary part of so many > programs. > > Is there really no way to populate a mutiselect with values from > another app? > > The Definitive Guide to Django says that a ManyToManyField will take > as its one argument only the name of a class from the same app. If > that's true, I don't see how anyone could develop a categories app in > django... perhaps I'm missing something? > > Thanks in advance for your help, > Ryan > > > > On Oct 27, 11:03 am, webcomm <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I have created a simple categories app, and now I want to be able to >> categorize my articles, which are handled by a different app. I'd >> like to create a multiselect categories field in my articles admin >> that is populated by the category entries from my categories app. >> >> In my categories app, I have to ability to create category groups. >> This is the models.py for the categories app... >> >> from django.db import models >> >> class Group(models.Model): >> name = models.CharField(max_length=200) >> >> def __str__(self): >> return self.name >> >> class Category(models.Model): >> group = models.ForeignKey(Group) >> name = models.CharField(max_length=200) >> >> def __str__(self): >> return self.name >> >> class Meta: >> verbose_name_plural = 'categories' >> >> I want to set up my articles admin interface so there is a different >> multiselect box for each category group, or one large multiselect with >> the categories organized in groups. >> >> I am not quite sure what to do in articles/admin.py and/or elsewhere >> to achieve this. >> >> Any ideas? >> >> Thanks, >> Ryan > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---