addons-server/apps/access/models.py

27 строки
579 B
Python

from django.db import models
import amo.models
class Group(amo.models.ModelBase):
name = models.CharField(max_length=255, default='')
rules = models.TextField()
users = models.ManyToManyField('users.UserProfile', through='GroupUser',
related_name='groups')
class Meta:
db_table = 'groups'
def __unicode__(self):
return self.name
class GroupUser(models.Model):
group = models.ForeignKey(Group)
user = models.ForeignKey('users.UserProfile')
class Meta:
db_table = u'groups_users'