1đź‘Ť
âś…
One of the first things it says on the django homepage is that django “encourages rapid development and clean, pragmatic design”… and they are really strict about this (which is why its great!). The framework is set up in a way that forces you to consider giving every view one specific purpose, which means that using a views post for two different purposes isn’t possible without a fugly if statement.
Your options:
-
Consider if you really need to have two purposes for one view, its perfectly acceptible for different views to use the same template
-
Look into making your view generic, django’s default generic views are pretty powerful on their own and depending on your scenarios it may be a viable option
-
Butchery
👤Sayse
Source:stackexchange.com