Commit e26ec531 authored by colmoneill's avatar colmoneill

making a admin view for eventbrite ids and processing those results in the events route

parent 685884c8
......@@ -107,6 +107,17 @@ class Role(db.Document, RoleMixin):
def __unicode__(self):
return self.name
class School(db.Document, RoleMixin):
name = db.StringField(max_length=80, unique=True)
description = db.StringField(max_length=255)
def __unicode__(self):
return self.name
class Events(db.Document):
eventbrite_id = db.StringField(required=True, unique=True)
human_readable_name_of_event = db.StringField()
# class Badge(db.Document): # UserMixin ? RoleMixin ?
# # _id = db.ObjectIdField(default = name)
# name = db.StringField(max_length=60)
......@@ -174,6 +185,7 @@ class User(db.Document, UserMixin):
badges = db.DictField(default = badges)
# badges = db.ListField(db.EmbeddedDocumentField(Badge))
roles = db.ListField(db.ReferenceField(Role))
school = db.ListField(db.ReferenceField(School))
# badges = db.ListField( db.ReferenceField(Badges))
# dashboard_view_count = db.StringField(max_length=3, default=[0])
meta = {'strict': False}
......@@ -345,6 +357,11 @@ def success():
def event():
eventbrite_json = ur.urlopen(eventbrite_url_requete)
events = json.loads(eventbrite_json.read().decode())
# get ids of events from admin
query = ""
for event in Events.objects():
query += event.eventbrite_id + " + "
print(query)
return render_template("event.html" , events = events )
@app.errorhandler(404)
......@@ -412,4 +429,5 @@ if __name__ == '__main__':
admin.add_view(UserView(User))
admin.add_view(RoleView(Role))
# admin.add_view(ModelView(Badge))
admin.add_view(ModelView(Events))
app.run(host='0.0.0.0', debug=True)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment