self.object is None because you the workflow is

def form_valid(self, form):
    self.object = form.save(commit=False)
    self.object.user = self.request.user
    self.object.save()
    super(CreateCampaignView, self).form_valid(form) # that does the 
redirect

actually it's not necesary to neme it self.object but is a good practice, 
is how other class-based generic views work

self.object is None because you are usin a CreateView, so there is no 
object to work with until you save the form and get the corresponding 
instance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/KuS19bSiqMIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to