add support for additional groups
This commit is contained in:
parent
01b05c5823
commit
9edbe6c898
3 changed files with 114 additions and 1 deletions
|
@ -1,4 +1,6 @@
|
|||
from django.db import models
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from model_utils.models import TimeStampedModel
|
||||
|
||||
|
@ -29,3 +31,16 @@ class Shadow(TimeStampedModel, models.Model):
|
|||
inactdays = models.PositiveSmallIntegerField(blank=True, null=True)
|
||||
expiredays = models.PositiveSmallIntegerField(blank=True, null=True,
|
||||
default=None)
|
||||
|
||||
|
||||
class AdditionalGroup(TimeStampedModel, models.Model):
|
||||
user = models.ForeignKey(User)
|
||||
group = models.ForeignKey(Group)
|
||||
|
||||
class Meta:
|
||||
unique_together = ('user', 'group')
|
||||
|
||||
def clean(self):
|
||||
if self.user.group == self.group:
|
||||
raise ValidationError(_(
|
||||
"You can not use a user's primary group."))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue