Django settings cant be changed on the fly.
>From the official documentation:
> You shouldn’t alter settings in your applications at runtime. For
example, don’t do this in a view:

I think the solution for your problem is to set or update
 'grappelli_admin_title'  context variable from the middleware or from a
custom context processor.

Looking at Grappellis code it seems this is the relevant code for your
problem:
grappelli/templates/admin/base.html
<h1 id="grp-admin-title">{% if grappelli_admin_title %}{{
grappelli_admin_title }}{% else %}{% get_admin_title %}{% endif %}</h1>


Using context processors is the best practice for this kind of problems.
For example:

def admin_title(request):
    """
        Adds media-related context variables to the context.
    """
    user_company_name = request.user.company_name
    return {'grappelli_admin_title': user_company_name, }


Regards



On Sun, Jun 23, 2013 at 3:47 PM, Richard E. Cooke <[email protected]>wrote:

> I'm using Grappelli to spruce up my Admin interface.
>
> I would like to customize the site name (and web page tittle).
>
> I have this in my project settings.py file:
>
> # http://django-grappelli.readthedocs.org/en/latest/customization.html
> GRAPPELLI_ADMIN_TITLE = "The Default Company"
>
>
> And in my middle ware I try to change it to match the company name of the
> connecting user:
> (This code snipped is abbreviated, don't try and copy and paste it into a
> file and run it!)
>
> from django.conf import settings
> def process_request(self, request):
>     settings.GRAPPELLI_ADMIN_TITLE = request.user.myuser.site.name
>
> But it seems to be a crap shoot if the title gets changed to the right
> value, or changed at all!
>
> More shared memory consequences?
>
> I could not find a "best practice" for this.  So, I suspect there is a
> "better way" I'm hoping somebody can enlighten me.
>
> Thanks in advance,
> Rich.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Serge G. Spaolonzi
Cobalys Systems
http://www.cobalys.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to