[Answered ]-How do I turn a django model method into a parameter?

2👍

Use property:

@property
def has_access_token(self):
    return True

>>> class MyModel:
...     def has_access_token_1(self):
...         return True
...     @property
...     def has_access_token_2(self):
...         return True
... 
>>> 
>>> obj = MyModel()
>>> obj.has_access_token_1
<bound method MyModel.has_access_token_1 of <__main__.MyModel instance at 0x7f07ed881ea8>>
>>> obj.has_access_token_2
True

Leave a comment