我想添加一个描述归档组, 怎么做? 编辑源代码?
@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,)
并有其他方式?
答案 0 :(得分:4)
尝试在models.py
from django.contrib.auth.models import Group
Group.add_to_class('description', models.CharField(max_length=180,null=True, blank=True))