Hi,

I have the following classes in my models.py:

class Default(models.Model):
    name = models.CharField(max_length=50, choices =
(('rental_period', 'rental_period'), ('currency', 'currency')),
unique=True)
    value = models.CharField(max_length=50)

class Media_biz(models.Model):
    name = models.CharField(max_length=50)
    currency = models.ForeignKey(Currency)
    rental_period = models.CharField(max_length=5, blank=True,
null=True)

What I want is:
When I add new Media_biz in my admin page, I want to check if there is
a Default object with the name "currency" or "rental_period" and take
it's value as default.

I tried to use "default" field option for this, but I can't insert
logic that checks Default objects in models.py, because it fails on
syncdb if my db is empty.

Does anybody have a solution how can I do that?

Thanks,
Arshavski Alexander.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to