I'm running into a stange issue in Django and I think it might be because I don't properly understand how class based views work.
Basically I have a ListView and a FormView. one is to list the objects, the other is to edit.
In a browser, if i navigate from listview to the formview of an existing object I get the expected result: the form fields are filled in with expected values.
The same formview is used for presenting a blank form where a user can create objects.
If i navigate from the form of an existing object to the formview of a new object or to the listview and then to the formview of a new object, initial (i.e. self.initial of the CBV) is prepopulated with information from the existing object previously visited.
Obviously I'm expecting self.initial to be blank at the beginning of a new get request.
My understanding was that each request generates a new instance of a classbased view. How is initial getting carried over across requests? I'm coming to this conclusion based on some debugging. relevant lines in get_initial() below.
def get_initial(self, **kwargs):
initial = super(M_EditNewsletterView, self).get_initial(**kwargs)
fs_logger.debug('initial immediately after super -> %s' % initial)
SO suggested this was similar, but I don't understand the answer with the upvote. Django(trunk) and class based generic views: one form's initial data appearing in another one's
can anyone help explain to me what is going on?