#32467: django admin widget.attrs not work with ForeignKey
------------------------------------------------+------------------------
Reporter: Hassan Igbaria | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Forms | Version: 3.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
self.fields['parent'].widget.attrs = {'class': 'custom-class'}
parent is ForeignKey field
class Category(models.Model):
title = models.CharField(_('Title'), max_length=300)
description = models.TextField(_('Description'), null=True,
blank=True)
is_active = models.BooleanField(_('Active ?'), default=True)
image = models.ImageField(
_('Image'), upload_to="category/", null=True, blank=True
)
parent = models.ForeignKey(
"self", verbose_name=_('Parent'), on_delete=models.SET_NULL,
null=True, blank=True
)
--
Ticket URL: <https://code.djangoproject.com/ticket/32467>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.0438b936e09f2ea1496c4c347ea222f5%40djangoproject.com.