[Answered ]-Call CURD operation of a class from another class

1👍

You can directly call the other class from the class you want
just use .create function and pass the required param

0👍

First of, I agree with Yussef’s answer. It should be working.

An alterntive would be inheritance:

class B(A):  # let B inherit from A
    def create(self, request, *args, **kwargs):
        print("here your logic")
        super().create(request, *args, **kwargs)  # call the function of parent class
        print("some more logic")

Sure, inheritance brings along more advantages, but those might also be disadvantage if it does not suit your needs. Because by inheriting from A, your class B now also has the same update function as A. Normal inheritance behaviour

Leave a comment