As of Django template to call a static method without passing explicitly the object from view?

I have a template (in app common). the template except the main content (news, articles,...) displays General information and some blocks (which are formed in other apps). General information (Setting) is available from the app website, the staff (Person) from the app staff

class Setting(models.Model):
 sitename = (...)
 phone = (...)
 email = (...)

@staticmethod
 def get_setting():
 return Setting.first()


class Person(models.Model):
...
@staticmethod
 def get_random():
 Person.objects.order_by('?').all()[:2]


can I directly call Setting.get_setting and Person.get_random(and if you can, how ?) or do I have to explicitly pass them from the view ?
June 3rd 19 at 19:10
1 answer
June 3rd 19 at 19:12
Solution

Find more questions by tags Django