Class views in Django

Django sight indicate a function, which can be a trouble if you intend to transform just a little capability. Yes, I can have million keyword debates and also a lot more if declarations in the function, yet I was assuming even more of an object oriented strategy.

As an example, I have a web page that presents a customer. This web page is really comparable to web page that presents a team, yet it's still not so comparable to simply make use of an additional information version. Team additionally has participants and so on.

One means would certainly be to aim views to class approaches and afterwards expand that class. Has any person attempted this strategy or has any kind of various other suggestion?

0
2019-05-05 01:01:44
Source Share
Answers: 3

Unless you intend to do something a little facility, making use of the common views are the means to go. They are even more effective than their name indicates, and also if you are simply presenting version information common views will certainly get the job done.

0
2019-12-01 22:40:07
Source

If you are merely presenting information from versions, why not make use of the Django Generic Views? They are made to allow you very easy show information from a version without needing to write your very own sight and also things concerning mapping URL paramaters to views, bring information, taking care of side instances, providing result, etc

0
2019-05-13 13:12:03
Source

Sounds to me like you're attempting to incorporate points that should not be incorporated. If you require to do various handling in your sight relying on if it's a User or Group object you're attempting to consider after that you need to make use of 2 various sight features.

On the various other hand there can be usual expressions you would certainly intend to extract out of your object_detail type views ... probably you could make use of a designer or simply assistant features?

- Dan

0
2019-05-08 05:30:45
Source