Django Signals - trigger when model changed

2019-10-05 Thread Omar Helal
Hi all, I came across this ticket in stack overflow to try to find a solution for the issue of calling a signal only when a particular field on a model was updated. https://stackoverflow.com/questions/39034798/django-signals-for-models-value-change-condition I didn't want to use any third

Re: Django Templates and Conditional CSS classes

2017-11-11 Thread Omar Helal
Hi treyd, I think idea of updating the model and storing it in the db is a bit overkill, however you could create an @propery on the model that will do that logic for you and return the css class for you. e.g. @property def css_class(self): if self.state is SUCHANDSUCH: return