As we all know, displaying a method return value as boolean in the Django admin is easily done by setting the boolean
attribute:
class MyMo
If you define is_something
as a property, it will be an immutable object, instead of a function, but that object contains a reference to the decorated getter in the fget
attribute. I think that the Django admin interface use the getter of that property, thus this may works
class MyModel(models.Model):
@property
def is_something(self):
if self.something == 'something':
return True
return False
is_something.fget.boolean = True