Say for example you have a Form with its validator methods. 
Then, in the view you normally do:

in forms.py,

if form.is_valid():
> # do some logic / add to database
> # redirect



Now: Is it good practise to do that "post-logic" inside Form methods or 
should I do it on the view? i.e.

in views.py,

def some_view(request):
> if request.method == 'POST':
> form = SomeForm(request.POST)
> if form.is_valid():
> form.some_logic(request.user)
> # redirect
> else:
> form = SomeForm()
> # render


in forms.py,

class SomeForm(forms.Form):
> def clean(self):
> # clean data
> def some_logic(self, user):
> # some logic w/ cleaned data

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cdb0ae37-7f46-42c0-b99c-f3a641bbad0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to