Code

Opened 7 months ago

Closed 7 months ago

#21155 closed Bug (duplicate)

Changing queryset of Model formsets in __init__ doesn't work

Reported by: yofee Owned by: nobody
Component: Documentation Version: 1.5
Severity: Normal Keywords: ModelFormSet, queryset
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In the documentation it says you could change the queryset of a Model formset by setting it in the __init__ method:

class BaseAuthorFormSet(BaseModelFormSet):
    def __init__(self, *args, **kwargs):
        super(BaseAuthorFormSet, self).__init__(*args, **kwargs)
        self.queryset = Author.objects.filter(name__startswith='O')

But in Django 1.5 it doesn't work. It was fixed in some former versions : #17478 (Django 1.3) and #11735 (Django 1.1)

Attachments (0)

Change History (1)

comment:1 Changed 7 months ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

This was fixed in #17478 three months ago (and not backported), that means that this should work in Django 1.6.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.