lqez / django-summernote

Simply integrate Summernote editor with Django project.
MIT License
1.05k stars 227 forks source link

How can i disable attachments? #468

Open medeiroslucass opened 2 years ago

medeiroslucass commented 2 years ago

How can i disable attachments? i tried to change my configuration in settings.py but i got this error: Reverse for 'django_summernote-upload_attachment' not found. 'django_summernote-upload_attachment' is not a valid view function or pattern name.

my settings.py: SUMMERNOTE_CONFIG = { 'iframe' : True, 'summernote' : { 'airMode': False, 'width' : '100%', 'lang' : 'pt-BR' }, 'disable_attachment': True, }

simonasjutkevicius commented 2 years ago

Hi,

urls.py of django-summernote 0.8.20.0 doesn't return the url 'django_summernote-upload_attachment' if SUMMERNOTE_CONFIG['disable_attachment'] == True but SummernoteWidgetBase tries to get this url in any case.

As a workaround I added this line to urls.py path('summernote/upload_attachment/', SummernoteUploadAttachment.as_view(), name='django_summernote-upload_attachment'), after this line path('summernote/', include('django_summernote.urls')),

Now this url is always available.

perepicornell commented 2 years ago

Thanks, after updating packages it just started crashing, this fix worked for me. If that's fixed in a future release I will appreciate a lot if someone can let us now in this thread. Take care!