I have a Django model that stores some rarely modified but frequently used data. I am looking for a template so that I can refer to them as variables of a static class, for example, like SomeModel.Baror SomeModel.Baz.
I am currently using staticmethod, for example:
class SomeModel(models.Model):
name = models.CharField(max_length=100)
@staticmethod
def Baz():
return baz
Meaning I treat elements like SomeModel.Baz (), but this is just not entirely correct. I just get the impression that I'm doing something wrong. I do not want this property, because I do not want the instance to refer to the element.
Can someone point me to a sample or example to show me if I can implement the class level property this way? Or tell me why should I do something completely different? Thank:).
source
share