On Thursday, September 29, 2016 at 4:11:04 PM UTC+2, is_null wrote:
>
> Thanks for the heads up, a similar ticket has been closed as wontfix, 
> because it isn't compatible with CSP: 
> https://code.djangoproject.com/ticket/13978
>
> While I'm all against inline scripts, I have a use case which seems be 
> legitimate: 
> https://github.com/yourlabs/django-autocomplete-light/pull/733/files#diff-469b501dd1f427cfe68aac4d27f28df3R84
>
> Basically, we render a `<script type="text/dal-forward-conf">json object 
> dump here</script>` next to the widget and use that to configure the script 
> for that widget. IMHO, the ideal solution would be to be able to place this 
> script tag in `{{ form.media }}` rather than next to the HTML widget.
>
>
There is precedent in Django (respectively django.contrib.admin) for adding 
attributes to the script tag, for example here:
https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/popup_response.html

I have an admittedly ugly hack here which allows (ab)using forms.Media for 
custom additional attributes here: (It works well and I sleep well, but 
it's not nice at all.)
https://github.com/matthiask/django-content-editor/blob/master/content_editor/admin.py#L93

If this is an acceptable way of delivering additional data to the frontend 
code I might work on that during a sprint some time?

Thanks,
Matthias


-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/2782925a-0d2f-44d9-a055-36b3cc4a1078%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to