Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Froala not working in Django admin's inlines #40

Closed
viktoradavid opened this issue May 12, 2017 · 5 comments
Closed

Froala not working in Django admin's inlines #40

viktoradavid opened this issue May 12, 2017 · 5 comments

Comments

@viktoradavid
Copy link

In Django admin, using FroalaField/FroalaWidget in inline model breaks the editor. No Froala buttons can be pressed, characters are not counted, placeholder doesn't disappear, no content is saved after submission.
This might be a general problem with formsets.

@Jufik
Copy link

Jufik commented May 18, 2017

Same in here, no JS error or any thing.
My guess is that it's hanging around initialization.

The issue happens when you try to add a new element in the inline.
If the form is already initialized -in my case using a min_num=1- I got it working.

@Wtower
Copy link

Wtower commented Jun 5, 2017

Great editor, but unfortunately same to me too. Subscribing.

@blablacio
Copy link

You could override your change_form.html with something along these lines:

{% extends 'admin/change_form.html' %}
{% load static %}

{% block admin_change_form_document_ready %}
{{ block.super }}
<script type="text/javascript">
(function($) {
    $(document).on('formset:added', function(event, $row, formsetName) {
        $row.find('textarea').each(function() {
            $(this).prev().remove();
            jQuery(this).froalaEditor();
        });
    });
})(django.jQuery);
</script>
{% endblock %}

@kentuck13
Copy link

I Caught 'admin/change_form.html' and add code as say blablacio. Now everywhere always work. THX!!!

@isDipesh
Copy link
Contributor

Thank you @blablacio .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants