Thursday, November 8, 2012

Reverse of admin:jsi18n

Using Django 1.3, I'm declaring a javascript file in the Media class of a ModelForm.  For the jsi18n javascript catalog, the examples show the path hard coded:

    js = ('/admin/jsi18n/')

However, I want to make this a little more portable by replacing the path with a reverse() call.  I tried this:

    js = (reverse('admin:jsi18n'))

which failed when the form was imported.  However, I can use the same argument in a URL call in the template:

    {% url 'admin:jsi18n' %}

Any advice on how I can use reverse() in the Media class?  I haven't found anything helpful in my searches.

Thanks,

Dan Gentry

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/WUsQvc_QxKAJ.
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