Django: Only one of two fields can be filled in
Posted
by Giovanni Di Milia
on Stack Overflow
See other posts from Stack Overflow
or by Giovanni Di Milia
Published on 2010-04-27T18:18:01Z
Indexed on
2010/04/27
18:33 UTC
Read the original article
Hit count: 366
django
|django-models
I have this model:
class Journals(models.Model):
jid = models.AutoField(primary_key=True)
code = models.CharField("Code", max_length=50)
name = models.CharField("Name", max_length=2000)
publisher = models.CharField("Publisher", max_length=2000)
price_euro = models.CharField("Euro", max_length=2000)
price_dollars = models.CharField("Dollars", max_length=2000)
Is there a way to let people fill out either price_euro
or price_dollars
?
I do know that the best way to solve the problem is to have only one field and another table that specify the currency, but I have constraints and I cannot modify the DB.
Thanks!
© Stack Overflow or respective owner