|
|
@ -1,18 +1,48 @@ |
|
|
|
from mongoengine import * |
|
|
|
from mongoengine import * |
|
|
|
|
|
|
|
|
|
|
|
from models.Union import Union |
|
|
|
from models.Union import Union |
|
|
|
|
|
|
|
from restapi import Methods |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Group(Document): |
|
|
|
class Group(Document): |
|
|
|
|
|
|
|
meta = { |
|
|
|
|
|
|
|
'index_background': True, |
|
|
|
|
|
|
|
'index_cls': False, |
|
|
|
|
|
|
|
'auto_create_index': True, |
|
|
|
|
|
|
|
'can_query': True, |
|
|
|
|
|
|
|
'with_sub_docs': True, |
|
|
|
|
|
|
|
'methods': [Methods.Get, Methods.List, Methods.Create], |
|
|
|
|
|
|
|
"indexes": [ |
|
|
|
|
|
|
|
('name'), |
|
|
|
|
|
|
|
("-name"), |
|
|
|
|
|
|
|
("union","deleted"), |
|
|
|
|
|
|
|
("union","deleted","name"), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
} |
|
|
|
union = ReferenceField(Union) |
|
|
|
union = ReferenceField(Union) |
|
|
|
name = StringField(required=True) |
|
|
|
name = StringField(required=True) |
|
|
|
rights = ListField(StringField(),required=True) |
|
|
|
rights = ListField(StringField(), required=True) |
|
|
|
deleted = BooleanField(default=False) |
|
|
|
deleted = BooleanField(default=False) |
|
|
|
|
|
|
|
|
|
|
|
def __unicode__(self): |
|
|
|
def __unicode__(self): |
|
|
|
return "{} {}".format(self.union.name,self.name) |
|
|
|
return "{} {}".format(self.union.name, self.name) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PaymentGroup(Document): |
|
|
|
class PaymentGroup(Document): |
|
|
|
|
|
|
|
meta = { |
|
|
|
|
|
|
|
'index_background': True, |
|
|
|
|
|
|
|
'index_cls': False, |
|
|
|
|
|
|
|
'auto_create_index': True, |
|
|
|
|
|
|
|
'can_query': True, |
|
|
|
|
|
|
|
'with_sub_docs': True, |
|
|
|
|
|
|
|
'methods': [Methods.Get, Methods.List, Methods.Create], |
|
|
|
|
|
|
|
"indexes": [ |
|
|
|
|
|
|
|
('name'), |
|
|
|
|
|
|
|
("-name"), |
|
|
|
|
|
|
|
("union"), |
|
|
|
|
|
|
|
('union','name',"deleted") |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
} |
|
|
|
union = ReferenceField(Union) |
|
|
|
union = ReferenceField(Union) |
|
|
|
name = StringField(required=True) |
|
|
|
name = StringField(required=True) |
|
|
|
deleted = BooleanField(default=False) |
|
|
|
deleted = BooleanField(default=False) |
|
|
|