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.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAKSEZ1EfdSiaNwd6ZxL0NUhfn3HM39zdbg1CVkRXNyObwLxjcA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment