Hi!

I am using the Site app to serve multiple sites with shared content in
the same django project. Now I want to be able to assign a owner
company for each site to display different copyright info, etc. So
what I would like to do is to add a ForeignKey to the site model
without having to create my own copy of the site app. Is there a one-
to-many relationship (the opposite of the ForeignKey that is many-to-
one) that I can add to the Company model?

What I would like to do is something like:

-----------------------------------------------------------------------
company.models.py:
-----------------------------------------------------------------------
from django.contrib.sites.models import Site

class Company(models.Model):
        name = models.CharField(max_length = 30)
        url = models.CharField(max_length = 100)
        sites = models.OneToMany(Site, related_name = 'company')

-----------------------------------------------------------------------
In the views
-----------------------------------------------------------------------
from django.contrib.sites.models import Site

current_site = Site.objects.get_current()
company = current_site.company

-----------------------------------------------------------------------

I guess this could be done with a many-to-many relationship in the
Company model as well, but that is kind of ugly. Is this possible or
is there some other way to solve this. It cant be such a uncommon
scenario.

/Fredrik

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