def __init__(self, *args, **kwargs): self.owner = kwargs.pop('owner', None) self.pref_filter = Pref.get_filter(self.owner) super(BasePrefForm, self).__init__(*args, **kwargs) for field_name, field in self.fields.items(): try: field.initial = preferences.get(field_name, owner=self.owner, default=field.initial) except AttributeError: pass