0

I'm developing an app in Django and would like to know what is the correct way to implement some small views that need to implement some specific function. I'm still a beginner and I've been using CBVs from the start but I'm not sure if I should use FBVs for this.

I now need to implement some specific functions when integrating Stripe, for example, to reactive a canceled subscription or to upgrade a subscription and was wondering if I should use FBVs for this? If not, should I for example use the POST of

class SubscriptionView(APIView):
    def post(self, request): 
        # Make a new subscription...

that I use to create a subscription and just check if the user is trying to reactive/upgrade with a parameter or something like that?

DjangoDev1
  • 232
  • 4
  • 14

1 Answers1

0

Consider this chart if you are indecisive on what type of method to use.

But generally some of the advantages of using CBVs on my experience are:

  1. They can be easily extended
  2. Code re usability
  3. Remove branching through the use of class methods, hence clean code.