views:

140

answers:

1

Hi everybody! I'm supposed to build some Django apps, that allow you to administer multiple sites through one backend. The contrib.sites framework is quite perfect for my purposes. I can run multiple instances of manage.py with different settings for each site; but how should django's admin deal with different settings for different sites, eg. if they have different sets of languages, a different (default) language? So there are some problem s to face if you have to work on objects coming from different sites in one admin...

I think settings.ADMIN_FOR is supposed to be quite helpful for cases like this, but theres hardly any documentation about it and I think it's not really used in the actual Django version (?).

So any ideas/solutions are welcome and much appreciated! Thanks a lot...

+1  A: 

There is an old blog post by James Bennet which might be helpful:

  1. Create a new Site object in your admin for each domain, and put the id of that Site into its settings file as SITE_ID so Django knows which site in the database corresponds to this settings file.
  2. In the settings file for your original site (the one with id 1), add the other sites’ settings files to the ADMIN_FOR setting, to let Django know that this one instance of the admin application will handle all of the sites.

As documented ADMIN_FOR (for which i can not post link) should be a tuple of settings modules much like INSTALED_APPS is a tuple of django app modules.

Note that blog post is from 2006 so it uses a bit outdated API.

rebus
Well that's exactly the information I have got. I'd be interested in HOW and WHERE Django would handle this issues in the Admin, so I did a search for "ADMIN_FOR" in Django's source code, and I couldnt find a place where it's really used, except once for displaying debugging informations...
lazerscience
Hmm, it does seem to be used only for admindocs and template validator. Strange. And the only topic on google seems to be yours. Have you tried on django-users, perhaps some of the core devs knows more.
rebus
I posted it on django-users as well, if anybody wants to join: http://groups.google.com/group/django-users/browse_thread/thread/d48353ba7fb1c741
lazerscience