|
|
|
@ -1,48 +1,18 @@ |
|
|
|
|
from mongoengine import * |
|
|
|
|
|
|
|
|
|
from models.Union import Union |
|
|
|
|
from restapi import Methods |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) |
|
|
|
|
name = StringField(required=True) |
|
|
|
|
rights = ListField(StringField(),required=True) |
|
|
|
|
deleted = BooleanField(default=False) |
|
|
|
|
|
|
|
|
|
def __unicode__(self): |
|
|
|
|
return "{} {}".format(self.union.name,self.name) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) |
|
|
|
|
name = StringField(required=True) |
|
|
|
|
deleted = BooleanField(default=False) |
|
|
|
|