I have a model and an admin defined:
models.py
from adminsortable.models import Sortable
class Category(Sortable):
site = models.ForeignKey('sites.Site', related_name='+', on_delete=models.CASCADE)
name = models.CharField(_('Name'), max_length=255)
slug = models.SlugField(_('Slug'), max_length=255, unique=True)
icon = ImageField(_('Icon'), upload_to='myapp/icons')
icon2 = ImageField(_('Icon 2'), upload_to='myapp/icons')
recommended_tags = TaggableManager(related_name='category', blank=True)
admin.py
from adminsortable.admin import SortableAdmin
class CategoryAdmin(SortableAdmin):
list_display = ['name', 'site']
list_filter = ['site',]
admin.site.register(Category, CategoryAdmin)
Looks like everything is fine but I get an IntegrityError when I try to create an object from admin panel. What's interesting, the object update is working fine. The problem is just when I try to create a new Category object.
django.db.utils.IntegrityError: null value in column "recommended_tags" violates not-null constraint
DETAIL: Failing row contains (64, ggggggggg, ggggggggg, myapp/icons/16.jpg, 31, myapp/icons/46.jpg, 1, null).
It is probably caused at admin save_model() method but I am not sure.
django 1.11
django-taggit 0.22.2
postgres database