79198501

Date: 2024-11-18 01:48:14
Score: 0.5
Natty:
Report link

The problem is with the order that javascript files are loaded for Django admin. To fix the order you have to:

  1. use a form in your admin.py for the model:
class ExercisesAdmin(SummernoteModelAdmin):     
    form = ExerciseAdminForm
    summernote_fields = ('content',)
 
  1. in your forms.py declare the correct order - see the reference here
class ExerciseAdminForm(forms.ModelForm):
    content = SummernoteTextField()

    class Media:
        js=["admin/js/vendor/jquery/jQuery.js", "studyspot/js/popper.min.js", "studyspot/js/bootstrap.min.js", "summernote/summernote-bs4.min.js",]

Note: bootstrap and popper have to be loaded before summernote as well as jquery. The summernote editor is now displaying but there is no styling. I'm sure there is a way to add the css styling for summernote in Django admin, if anyone knows how, please add your answer.

Reasons:
  • Blacklisted phrase (1): anyone knows
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
Posted by: Lawrence DeSouza