How to call a method inside the class model in python django
- 255
- 2
-
- Last Comment
In models.python
class ModelA(models.Model):
…
def methodA(self):
return …
methodA() # How to call this methodA, this line is giving error.
How to call methodA from inside the class. I tried self.methodA(), but there is NameError on ‘self’. I also tried ModelA.methodA(), but here comes an error as name ‘ModelA’ is not defined.
Expired
1 Comment
|
2 Dimers
- Sort By
Click here to reply
post the same on stackoverflow