Ticket #12213: 12213.diff
File 12213.diff, 1.2 KB (added by , 15 years ago) |
---|
-
django/django/forms/models.py
702 702 class BaseInlineFormSet(BaseModelFormSet): 703 703 """A formset for child objects related to a parent.""" 704 704 def __init__(self, data=None, files=None, instance=None, 705 save_as_new=False, prefix=None ):705 save_as_new=False, prefix=None, initial=None, queryset_filter=None): 706 706 from django.db.models.fields.related import RelatedObject 707 707 if instance is None: 708 708 self.instance = self.fk.rel.to() … … 716 716 else: 717 717 backlink_value = getattr(self.instance, self.fk.rel.field_name) 718 718 qs = self.model._default_manager.filter(**{self.fk.name: backlink_value}) 719 if queryset_filter and isinstance(queryset_filter, dict): 720 qs = qs.filter(**queryset_filter) 719 721 super(BaseInlineFormSet, self).__init__(data, files, prefix=prefix, 720 queryset=qs )722 queryset=qs, initial=initial) 721 723 722 724 def initial_form_count(self): 723 725 if self.save_as_new: