Note: I am not sure class based views are a great fit for every view.
They are great for basic CRUD views and for avoiding repetition.
However, inheritance somewhat obscures the program flow and makes the code more difficult to understand in my opinion, compared to function based views. For example, an ID input from the URL is no longer given as an explicit function argument, but instead has to be set using pk_url_kwarg and read from kwargs.
As an alternative to mixins, in FBV commonly used code can be handled using decorators to prevent duplication.
Particularly for OnboardingExitView and ManualOnboardingView, FBV would be clearer in my opinion.
Should we use CBV exclusively in Trustpoint for the sake of consistency, or should we use both depending on what makes the cleanest code?
Note: I am not sure class based views are a great fit for every view. They are great for basic CRUD views and for avoiding repetition.
However, inheritance somewhat obscures the program flow and makes the code more difficult to understand in my opinion, compared to function based views. For example, an ID input from the URL is no longer given as an explicit function argument, but instead has to be set using
pk_url_kwarg
and read from kwargs.As an alternative to mixins, in FBV commonly used code can be handled using decorators to prevent duplication. Particularly for
OnboardingExitView
andManualOnboardingView
, FBV would be clearer in my opinion.Should we use CBV exclusively in Trustpoint for the sake of consistency, or should we use both depending on what makes the cleanest code?
An interesting read on the topic: https://spookylukey.github.io/django-views-the-right-way