I'm initializing my forms this way:

    def __init__(self, league, *args, **kwargs):
        super(TeamForm, self).__init__(*args, **kwargs)
        self.fields["team"].queryset=Team.objects.filter(
            league=league
        )
    ...

But then I read this comment by Malcolm saying that I should move it
into **kwargs instead and do it this way to avoid conflict with a
possible "data" parameter passed in by Django:

        def __init__(self, *args, **kwargs):
           team = kwargs.pop("team")
           super(TeamForm, self).__init__(*args, **kwargs)
           ...

(http://groups.google.com/group/django-users/browse_thread/thread/
3560bd448b04fd6d/98c3f4a5cb1e68ad?lnk=gst&q=formset#98c3f4a5cb1e68ad)

Does his comment apply only to formsets or to forms in general?  I'd
do it the second way from now on, but I'd like to know if I should go
back and refactor all my previous forms definitions.
--~--~---------~--~----~------------~-------~--~----~
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