Tuesday, June 29, 2010

Re: context porcessors request.context media_url breaks admin

On 29 juin, 00:44, justin jools <justinjo...@gmail.com> wrote:
> I am trying to use media_url with generic views:
> When I set context processors to media_url, with generic views it
> breaks Admin:
>
> Caught an exception while rendering: user
>
> settings.py
> TEMPLATE_CONTEXT_PROCESSORS =
> ('portfolio.context_processors.media_url',)
>
> context_processors.py
> def media_url(request):
>     from django.conf import settings
>     return {'media_url': settings.MEDIA_URL}
>
> urls.py
> from django.template import RequestContext
>
> urlpatterns = patterns('',
>     (r'^admin/', include(admin.site.urls)),
>     (r'^work/$', 'django.views.generic.list_detail.object_list',
> dict(info_dict, template_name="portfolio/projects_list.html")),
> )
>
> and when I remove it the admin works, but I have no media_url
> reference
>
> Any suggestions please?

Check your MEDIA_URL and ADMIN_MEDIA_PREFIX settings, collisions can
happen - like if your MEDIA_URL is '/medias/' and your
ADMIN_MEDIA_PREFIX is '/medias/ too - that have this exact result.
FWIW, you can set the ADMIN_MEDIA_PREFIX to whatever you want (I
usually use '/admins-medias/' to avoid the above problem).

HTH

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate