Good day!
How are you?
I have the following situation:
In more than one django project I come across the situation where I need to define a model that has a State.
So what I usually do is:
# Pseudo code here
def State (models.Model):
name = models.CharField ()
def Purchase (models.Model):
# Fields various (name, descrption, etc)
State = models.ForgeinKey (State)
# More fields ...
The problem arises when I want to do things like:
if (Purchase.State_id == 1):
# Do stuff
my way to fix it so far was to define a const.py and do something like:
if (== Purchase.State_id Const.STATE_EGGS):
# Do stuff
Because the state 1 is "eggs", but because I add in my local, but if another dev adds in staging, as that uniformity is maintained?
It should create a process that creates the updates as new constants was defined?
There are best practices for this?
Ideas? Advice?
Thank you very much for reading =)
regards,
Julian.