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