Ticket #12213: 12213.diff

File 12213.diff, 1.2 KB (added by ramusus, 15 years ago)

Patch with fixing this gaps

  • django/django/forms/models.py

     
    702702class BaseInlineFormSet(BaseModelFormSet):
    703703    """A formset for child objects related to a parent."""
    704704    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):
    706706        from django.db.models.fields.related import RelatedObject
    707707        if instance is None:
    708708            self.instance = self.fk.rel.to()
     
    716716        else:
    717717            backlink_value = getattr(self.instance, self.fk.rel.field_name)
    718718        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)
    719721        super(BaseInlineFormSet, self).__init__(data, files, prefix=prefix,
    720                                                 queryset=qs)
     722                                                queryset=qs, initial=initial)
    721723
    722724    def initial_form_count(self):
    723725        if self.save_as_new:
Back to Top