AdminTagWidget remains collapsed after fieldset is opened
StuartMacKay opened this issue · 0 comments
StuartMacKay commented
If you include a field that uses the AdminTagWidget in a fieldset where the initial state is collapsed, when the group is opened the field is zero width.
For example, the "topics" field:
fieldsets = (None, {"fields": ("title", "summary", "tags", "publish",)},), (
"Feed",
{
"classes": ("collapse",),
"fields": (
"author",
"date",
"topics",
),
},
)
When the "Feed" group is opened you see the following:
The field appears to be functional, you can click inside it and the dropdown appears - though it is zero-width also. Picking an item (presumably) does not change the width.
There is a formfield_overrides but it does not affect the behaviour:
formfield_overrides = {
models.CharField: {"widget": TextInput(attrs={"size": "80"})},
models.URLField: {"widget": TextInput(attrs={"size": "80"})},
TagField: {"widget": AdminTagWidget(attrs={"size": "80"})},
models.TextField: {"widget": Textarea(attrs={"rows": "10", "cols": "80"})},
}
Topic is a custom model but there is no additional media added:
from django.db import models
from django.utils.translation import gettext_lazy as _
import tagulous.models
class Topic(tagulous.models.TagTreeModel):
class Meta:
verbose_name = _("Topic")
verbose_name_plural = _("Topics")
class TagMeta:
force_lowercase = True
space_delimiter = False
autocomplete_view = "topic_autocomplete"
title = models.CharField(
verbose_name=_("Title"),
help_text=_("The human-readable name for the topic"),
max_length=100,
default="",
)
description = models.TextField(
verbose_name=_("Description"),
help_text=_("A short summary of what the topic covers"),
blank=True,
)
def save(self, **kwargs):
if not self.pk:
self.title = self.name
super().save(**kwargs)