根据状态,CSS将应用于我的对象。
<div class="object" data-status="{{object.status}}">
...
</div>
如何正确处理越来越多的条件状态?
def get_a(self):
a = False
if conditions:
a = True
return a
def get_b(self):
b = False
if conditions:
b = True
return b
# further checks for further states
...
def get_status(self):
if self.get_a():
return "a"
if self.get_b():
return "b"
if ...