I'm trying to refactor some (4 in number) ajax views which work almost same as the following procedure:
- Get some (2-4 in number) of objects using args
- Return a json if any of the objects were not found, else continue
- Then we extract another object (using the objects found in step 1) to update and create one if not found
- Create a new form depending on the type of the object we got in step 3 and validate and update the object
- Return a json in the end depending on form validity
The first 2 steps are common in all 4 ajax views. Even the models from which they try to extract the objects using args is common.
However, step 3 onwards things are very distinct in nature. The model used to extract the object and in turn the form used for validation. Also depending on the model there are certain more stuff happening in 2 of those ajax-views.
I'm quite new to Class-based Views and read this and this. Yet, I'm unable to see if I'd be making a drastically convenient future in terms of maintenance if I convert those 4 ajax-views to CBVs. And yeah, there's possibility that we create another such ajax-view once every year.
Question is: Should I use CBV or not, given that I can only stop replication of first 2 steps if I used CBV?