Diverse views widely used by the Django community?

I'm new to Django and Python, and after a lot of reading, I decided not to use global functions as representations (perhaps because I'm not used to global functions, but mainly because I want a better level of reuse and prefer to have smaller blocks code). The problem is that most of the Django applications I tested do not use a class based approach.

Is it because I'm checking the code in the wrong places (I started with the Django tutorial and then on github)?

I ask about this because in the future I hope to work with a large number of Django programmers and do not want to take a non-standard approach in the beginning.

+8
python django django-class-based-views
source share
1 answer

One fact is that the class view is based on Django 1.3 , so if you plan on supporting the old version of Django, than you should stick to the function view, for example, if you want to create a universal application and run it on GitHub or for other users.

As for when to use the class-based representation of the function representation, I think it will depend on your use case, my advice is that you should understand the advantage of each of them, and IMHO it's normal to have both an implementation in one project.

There was this good article by Nick Coglan in response to another great CBV article was a mistake worth checking out.

Hope this was helpful :)

+10
source share

All Articles