docker compose volumes fix import fix add methods and indexes for modelsmaster
parent
24b5ebc40a
commit
73a5820535
@ -1,22 +1,52 @@ |
||||
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) |
||||
rights = ListField(StringField(), required=True) |
||||
deleted = BooleanField(default=False) |
||||
|
||||
def __unicode__(self): |
||||
return "{} {}".format(self.union.name,self.name) |
||||
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) |
||||
discount_percent = IntField(required=True) |
||||
|
||||
def __unicode__(self): |
||||
return "{} {}".format(self.union.name, self.name) |
||||
return "{} {}".format(self.union.name, self.name) |
||||
|
Loading…
Reference in new issue