On Thu, Sep 23, 2010 at 7:37 PM, Daniel Roseman <dan...@roseman.org.uk>wrote:
> On Sep 23, 6:26 pm, Marc Aymerich <glicer...@gmail.com> wrote: > > Hi > > I'm trying to define two clases, one of them is a relational class > between > > services and users, so it has two foreign keys, one to services and > another > > to the user. On the other hand every service must have at least a default > > tariff, so it has a "pointer" to it. However, I'm not sure how to declare > > it, as i can not reference the class that is still to be defined. Do you > > have any suggestion? > > > > class service(models.Model): > > name = models.CharField(max_length=128) > > default_tariff = models.OneToOneField(tariff) > > > > class tariff(models.Model): > > service = models.ForeignKey(service) > > user = models.ForeignKey(User) > > price = models.CharField(max_length=64) > > > > Thanks a lot. > > -- > > Marc > > http://docs.djangoproject.com/en/1.2/ref/models/fields/#lazy-relationships > -- > DR. > > Thanks for that daniel!! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.