On 29 mar, 09:11, gontran <geoffroydecorb...@gmail.com> wrote:
> Hi everybody,
>
> considering the folowing models:
>
> UserProfile(models.Model):
>     user = models.OneToOneField(User)
>     company = models.ForeignKey(Company)
>
> Company(models.Model):
>     product_licences = models.manyToManyField(ProductLicence)


Sorry if I missed something, but are you sure you want a m2m
relationship here ??? This means that a same licence can "belong" to
many companies, which seems rather weird to me. As far as I'm
concerned I'd make "company" a foreign key in ProductLicence - or I
just don't understand your definition of what "licence" is ???


> Product(models.Model):
>     ...some fields...
>
> ProductLicence(models.Model):
>     product = models.ForeignKey(Product)
>


(snip)

-- 
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