Right - the error is caused because you’re trying to use Variable as a module-level variable. Remove the module-level reference and the error goes away - no need at that point to comment lines.
Briefly, yes. it would be perfectly valid to write:
def real_price(self):
return self.price * Variable.objects.get(pk=1).hour_price
<opinion>
(Side note: @property
is syntactic sugar. In the context of Django, there are very few situations where it’s needed - and this isn’t one of them.)
<opinion>