Search code examples
djangopython-3.xdjango-adminsummernote

Django-Admin and Django-Summernote create a file field in my forms


I am customizing django-admin with summernote and so far so good, but for some reason it creates a file field in my forms which is never allowed to be empty and I can't update records without uploading dummy files. Please see attachment.

enter image description here

My admin.py code is:

rom django.contrib import admin
from django_summernote.admin import SummernoteModelAdmin
from .models import Post, Category, Tag


# Register your models here.
# admin.site.register(Post)

# POST
@admin.register(Post)
class PostAdmin(SummernoteModelAdmin):
    """ Registers the model Post in the Admin Site """
    list_display = ('title','publish','status')    # Columns to display
    list_filter = ('status','created','publish','author')           # Filter by on right column
    search_fields = ('title','body')                                # Search in these fields
    prepopulated_fields = {'slug': ('title',)}                      # Prepopulate
    filter_horizontal = ('tag',)
    raw_id_fields = ('author',)                                     
    date_hierarchy = 'publish'
    ordering = ('status', 'publish')
    summernote_fields = ('body',)

How can I remove the "file" field from there?

Please help.

Many thanks.


Solution

  • I had this same issue today after upgrading Django-Summernote from version 0.8.11.4 to 0.8.11.5 (the current version).

    Can solve two ways:

    1. Comment out Django-Summernote -- don't use
    2. Downgrade to version 0.8.11.4 with pip

      pip uninstall django-summernote

      pip install django-summernote==0.8.11.4