add union api

create union meta data for rest api
master
Mustafa Yontar 4 years ago
parent 90cc69fe05
commit 4e4b253c5e
  1. 1
      main.py
  2. 14
      models/Union.py

@ -17,6 +17,7 @@ app = Flask(__name__)
app.secret_key = "secret_key+secret_key"
api = MongoApi(app)
api.register_model(User,uri="/api/user")
api.register_model(Union,uri="/api/union")
adm = Admin(app)
adm.add_view(ModelView(User))
adm.add_view(ModelView(Union))

@ -3,8 +3,22 @@ from werkzeug.security import generate_password_hash
from string import ascii_letters, digits
from random import choices
from restapi import Methods
class Union(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"),
]
}
name = StringField()
logo = ImageField(thumbnail_size=(120, 120))
description = StringField()

Loading…
Cancel
Save