Hi, Thanks for the fast reply. Each Default instance provide default value for one of the fields: I want to take the default value of rental_period to rental_period and default value of currency to currency. The value of the currency should be the name of Currency object for foreign key.
Thanks, Alex A. On Feb 5, 10:59 pm, Rajesh Dhawan <rajesh.dha...@gmail.com> wrote: > On Feb 5, 10:59 am, knight <alexar...@gmail.com> wrote: > > > > > 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. > > You want to take its value as default for what field of Media_biz? And > if you have two Default instances (one for currency and another for > rental_period), which one provides the default value? > > -RD --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---