Question

I've started using django-taggit and it seems to fit the bill. But for me there is still an issue with the admin site:

I included the tags attribute in the ModelAdmin like this:

class MyModel(db.models.Model):
    name = models.CharField(max_length=200)
    tags = TaggableManager()

class MyModelAdmin(admin.ModelAdmin):
    fieldsets = (
        (None, {
            'fields': ('name', 'tags')
        }),
    )

And everything goes as expected. But when I edit a model in the admin, I get an error, if the TagField is empty. The form seems to be happy with just a blank, and that results in no tags being saved (as expected). But an empty tag field triggers the error.

What can I do?

Was it helpful?

Solution

Did you try tags = TaggableManager(blank=True)?

blank – Controls whether this field is required

... at least that's what the docs say.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top