Answer the question
In order to leave comments, you need to log in
How to solve the problem of calling super() from a function?
Hello!
There is a serializer class OrgLegalFormSerializer:
class OrgLegalFormSerializer(serializers.ModelSerializer):
def update(self, instance, validated_data):
return update_with_activation_check(self, instance, 'code', **validated_data)
class Meta:
model = OrgLegalForm
fields = '__all__'
def update_with_activation_check(self, instance, unique_code_field=None, **validated_data):
#какой-то код
return super().update(instance, validated_data)
Answer the question
In order to leave comments, you need to log in
I'll post it here for anyone who needs it:
class GrandFather():
def update(self, cls):
return super(cls, self).update()
class Father():
def update(self):
print("Luke, I am your father!")
class Son(Father,GrandFather):
def test(self):
GrandFather.update(self,Son)
test = Son()
test.test()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question