You are defining a method of the class. That requires a "self"
argument, even if
you are not using it in the body. Attempting to call it will raise an error.
So, either make that line:
def modelName(self):
Or declare it to be a staticmethod, which can still be called via an
instance, but w
Hi,
How can I use model name in Templates?
I tried something like this:
Firstly model is here,
class ModelNameXxxx(models.Model):
field = .
def modelName():
return "ModelNameXxxx"
and in template side:
{{ p.modelName }}
2 matches
Mail list logo