i want add a description filed to Group, how to do it? edit source code?
@python_2_unicode_compatible
class Group(models.Model):
name = models.CharField(_('name'), max_length=80, unique=True)
description = models.CharField(_('description'), max_length=180,
null=True, blank=True) # add
permissions = models.ManyToManyField(
Permission,
verbose_name=_('permissions'),
blank=True,
)
objects = GroupManager()
class Meta:
verbose_name = _('group')
verbose_name_plural = _('groups')
def __str__(self):
return self.name
def natural_key(self):
return (self.name,)
and have other way?
Try using this in your models.py
from django.contrib.auth.models import Group
Group.add_to_class('description', models.CharField(max_length=180,null=True, blank=True))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With