Hello,
Suppose we have two models:
CH_AUTH = ((u'J', u'John'),(u'P', u'Peter'),(u'M', u'Marc'),)
class Publisher(models.Model):
name = models.CharField(max_length=100)
class Book(models.Model):
publisher = models.ForeignKey(Publisher)
author = models.CharField(max_length=1, choices=CH_AUTH)
title = models.CharField(max_length=100)
in a view:
publ = Publisher.object.get(pk=publisher_id)
BooksInlineFormSet = inlineformset_factory(Publisher, Book, extra=1)
formset = BooksInlineFormSet(instance=publ)
formset returns the saved formset(s) and an empty form
ie formset.forms[1]['author'] returns a html <select> with all authors.
but what if I want to exclude 'Marc' from the author selection?
I have been looking at the BaseInlineFormSet but got stuck.
Any clues? Your help is appreciated!
thank you,
Dimitri
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---