所以,假设这是我的模型:
class Project(models.Model):
STATUS_NEW = 1
STATUS_VERIFICATION = 2
STATUS_ACCEPTED = 3
STATUS_CHOICES = (
(STATUS_NEW, _('New')),
(STATUS_VERIFICATION, _('Ready for verification')),
(STATUS_ACCEPTED, _('Accepted')),
)
status = models.PositiveSmallIntegerField(_('Status'), choices=STATUS_CHOICES, default=STATUS_NEW)
实现字段权限的最佳方法是什么,以便用户可以将项目状态从 1(新)更改为 2(准备验证),但不能将其状态更改为 3(已接受)?