Wednesday, March 6, 2013

Reusing admin components?

(Working with Django 1.4)

I would like to re-use Django admin's FilteredSelectMultiple widget inside a custom form.  Right now I am working with "runserver" so I do NOT need instructions for doing this on a server.

There are many good articles on the "how to" of this; but most of them, when referring to the components you need to enable, use an approach of:

<script type="text/javascript" src="{{ADMIN_MEDIA_PREFIX}}js/core.js"></script>
<script type="text/javascript" src="{{ADMIN_MEDIA_PREFIX}}js/getElementsBySelector.js"></script>
<script type="text/javascript" src="{{ADMIN_MEDIA_PREFIX}}js/actions.js"></script>
<script type="text/javascript" src="{{ADMIN_MEDIA_PREFIX}}js/SelectBox.js"></script>
<script type="text/javascript" src="{{ADMIN_MEDIA_PREFIX}}js/SelectFilter2.js"></script>


Now I know the {{ADMIN_MEDIA_PREFIX}} is deprecated in 1.4 (removed in 1.5?) and so I need to replace it. 

My questions are:
1.  what I use instead of  {{ADMIN_MEDIA_PREFIX}}?
2. what value do I assign to THE_NEW_PREFIX (i.e. name of new variable) in my settings file?

(NOTE: I do not want to copy or move files, nor do I want to add symlinks to them - I just need to refer to the existing files which appear under "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/js/", and I need a standard Django way of doing so.)

Thanks!
Derek

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

No comments:

Post a Comment