formfield_callback argument was the solution to my problem

On Mon, Sep 14, 2009 at 4:18 PM, dimitri pater - serpia
<dimitri.pa...@gmail.com> wrote:
> 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 can't have everything. Where would you put it? -- Steven Wright
---
please visit www.serpia.org

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to