id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 21967 ModelFormMixin have extra logic in get_form_kwargs that crash view lagovas.lagovas@… Ryan Kaskel "When view inherit FormView and ModelFormMixin, have correct form_class and model fields, view will crash with AttributeError at / 'AddNoteView' object has no attribute 'object' in this code: {{{ class ModelFormMixin: .... def get_form_kwargs(self): """""" Returns the keyword arguments for instantiating the form. """""" kwargs = super(ModelFormMixin, self).get_form_kwargs() kwargs.update({'instance': self.object}) return kwargs }}} It's due to accessing to self.object before form.save(). Even in get request, when object can't be exist. To check this you need inherit from FormView and ModelFormMixin: class AddNoteView(FormView, ModelFormMixin): template_name = 'notes.html' form_class = NoteForm success_url = reverse_lazy('index') model = Note " Cleanup/optimization closed Generic views dev Normal fixed generic edit ModelFormMixin Accepted 1 0 0 0 1 0