Friday, July 22, 2016

Django-filer FilerImageField how to use widget outside admin

I want to use the FilerImageFieldin one of my model field and want the user to edit outside the admin area but when I try to load it, the widget doesn't work correctly and in the browser console I get and error in the javascript generated:


Uncaught TypeError: Cannot read property 'jQuery' of undefined


In here:


            <script type="text/javascript" id="id_featured_image_javascript">                  django.jQuery(document).ready(function(){                      var plus = django.jQuery('#add_id_featured_image');                      if (plus.length){                          plus.remove();                      }                      // Delete this javascript once loaded to avoid the "add new" link duplicates it                      django.jQuery('#id_featured_image_javascript').remove();                  });              </script>


The field in my model is defined like this:


featured_image = FilerImageField(db_column="FEATURED_IMAGE",                                   verbose_name=_('Featured Image'),                                   related_name='IPP_ARTICLE_FEATURED_IMAGE')


Do you have any idea why I can't use this field widget outside the admin? Do I need to set some configuration for this?


Thank you :)

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/684a52b7-276d-49d2-a2f8-9f5b50072f9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment