I’m looking to create an Admin so that when a user from one Site logs
into the admin they will not be able to see or modify entries for
other sites.

An example might help.  Say you have a blog application and you use
the django.contrib.site framework so that you can run multiple blogs,
each with its own domain.

from django.db import models
from django.contrib.sites.models import Site

class BlogEntry(models.Model):
        title = models.CharField()
        article = models.TextField()
        site = models.ForeignKey(Site)

I want each Blog owner to appear have their own Admin that will only
display their blog entries.  So if a user goes to foo.com/admin and
login they get access to only the Example.com blog entries.  Not the
bar.com blog entries.  Similarly, when a user logs in at bar.com/admin
they get just the bar.com entries.

I tried using a site specific object manager for BlogEntry above by
adding "objects = CurrentSiteManager()", as suggested in the docs:

"Also, note that certain parts of Django -- namely, the Django admin
site and generic views -- use whichever manager is defined first in
the model, so if you want your admin site to have access to all
objects (not just site-specific ones), put objects = models.Manager()
in your model, before you define CurrentSiteManager." (http://
docs.djangoproject.com/en/dev/ref/contrib/sites/)

However, it didn't seem to make any difference and entries were
visible regardless of which domain I used to create them.

Do I need to subclass AdminSite in contrib.admin.sites.py?  Or modify
the Admin views?

I’ve read all the documentation on django.contrib.admin and
django.contrib.sites, but I haven’t found a solution.  It seems like
this should be possible, but I’m just not sure how to go about it.
Any suggestions you can offer would be greatly appreciated.

I'm using django version 1.0.2 final and Python 2.6.1.  If it makes
any difference I'm using the builtin django test server ("manage.py
runserver").

Cheers,
Steve

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