Re: Class based views and form processing

2011-01-12 Thread Justin Murphy
Thanks, Skylar. You're right, it worked. Now I am just shaking my head and saying "next time, I'll just read the source..." -Justin -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.

Re: Class based views and form processing

2011-01-12 Thread Skylar Saveland
what's wrong with just defining form_valid sth like: form_valid(self, form): self.object = form.save(commit=False) #ponies self.object.save() return HttpResponseRedirect(self.get_success_url()) does that not work? -- You received this message because you are subscribed to the

Re: Class based views and form processing

2011-01-12 Thread Skylar Saveland
instead of calling super, you could just call FormMixin.form_valid directly, yes? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to

Re: Class based views and form processing

2011-01-12 Thread Justin Murphy
Hi, I still haven't found an answer to this problem so I am shamelessly bumping the last updated date. Thanks in advance for your help! -Justin -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@

Re: Class based views and form processing

2011-01-10 Thread Justin Murphy
Thanks, Łukasz. I looked into overriding that method too, but it seems like there should be a cleaner way. I almost feel like the ``ModelFormMixin`` should have an API similar to a ``ModelAdmin`` where one could override a ``save_model()`` method on the subclass. The ``form_valid()`` method doe

Re: Class based views and form processing

2011-01-09 Thread Łukasz Rekucki
``CreateView`` includes ``ModelFormMixin``, which is responsible for saving the model form: def form_valid(self, form): self.object = form.save() return super(ModelFormMixin, self).form_valid(form) So, you need to override that method in your subclass: class ListCreateView(Cr

Class based views and form processing

2011-01-09 Thread Justin
Hello, I am experimenting with the new class based views coming in 1.3 and am having trouble figuring out when/where to put this code. I want to populate a model's created_by field with the user of the current request. In the old views, I would have done something this: obj = form.save(commit=Fal