Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

163
Views
TaggableManager with blank=True raise IntegrityError when creating object in admin panel

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

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!