Sure, you would just override the get() and post() and possibly dispatch()
methods in your classes as needed.

I always recommend the classy CBV inspector, helps immensely with
understanding the available methods and inheritance in the CBV's.

http://ccbv.co.uk/

Also check out the source code of Django to see how they implement each of
the generic CBV's on GitHub in django.views.generic.

However, if you have working view functions, what is the"need" to switch to
CBV's?

FBV's may be more appropriate if you have a ton of logic to handle various
types of requests via a single view, which sounds like it may be the case
here. CBV'S don't pay out well in that regard from a simplicity standpoint,
although they are more than capable.

-James
Hi all,
I'm on a Django project, and I have written the following functions in my
views.py.

def my_view_function_1(request):
    #Some code
    return HttpResponse(------)


def my_view_function_2(request):
    #Some code
    return HttpResponse(------)


def my_view_function_3(request):
    #Some code
    return HttpResponse(------)


Some of them are POST requests and some of them are GET.
I need to switch to class based views. Is there any ways to include
multiple GET requests and POST requests in class based views?

 --
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/9ea40ca1-387e-4234-be01-504886d7de07%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/9ea40ca1-387e-4234-be01-504886d7de07%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.

-- 
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/CA%2Be%2BciU%2B%2BEpZ4wDbmpk6gUCfX5HKK%3D%3DNM-ytoUngS3%2BLPSm4xA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to