Django doesn't support that out of the box. I searched and couldn't
find anything. Self plug: I created an app that does exactly this.

http://code.google.com/p/django-namespace/

Only difference is I called the model Namespace instead of Domain.
Just download it, then add it to your INSTALLED_APPS.

You can then create different Namespaces in the admin, and give either
users or groups access to them. Then their builtin django privileges
apply only to those namespaces.

Then for any model that needs to be in a domain/namespace, subclass
the NamespacedModel like so. Basically this just adds a foreign key to
the Namespace model.

from django_namespace.namespace.models import NamespacedModel

class Task(NamespacedModel):
    name = models.CharField(max_length = 250)
    parent_task = models.ForeignKey('self',  related_name='Parent
Task',  blank=True,  null=True)

Then when you register the model for the admin, use the
NamespacedAdmin class (or you can subclass it). This takes care of
making sure users in DomainA can only see/edit/delete tasks in that
domain.

from django_namespace.namespace.admin import NamespacedAdmin

admin.site.register(Task, NamespacedAdmin)

See the usage for some examples. I think it's pretty straight forward
if you're familiar with Django. I've been using it in an internal
project with great success.

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

Reply via email to