diff --git a/goathacks/admin/events.py b/goathacks/admin/events.py index 811bffa..5c0c1ad 100644 --- a/goathacks/admin/events.py +++ b/goathacks/admin/events.py @@ -67,6 +67,7 @@ def update_create_event(id): datetime.time.fromisoformat(start_time)) end = datetime.datetime.combine(datetime.date.fromisoformat(end_day), datetime.time.fromisoformat(end_time)) + category = request.form.get("category") if id == 0: # new event @@ -75,6 +76,7 @@ def update_create_event(id): description=description, location=location, start_time=start, + category=category, end_time=end) db.session.add(e) db.session.commit() @@ -88,6 +90,7 @@ def update_create_event(id): e.location = location e.start_time = start e.end_time = end + e.category=category db.session.commit() current_app.logger.info(f"{current_user} is updating an existing event: {e.name}") diff --git a/goathacks/models.py b/goathacks/models.py index a665b92..0ff2f20 100644 --- a/goathacks/models.py +++ b/goathacks/models.py @@ -21,6 +21,8 @@ class User(db.Model, UserMixin): phone = Column(String, nullable=True) gender = Column(String, nullable=True) + def __str__(self): + return f"{self.first_name} {self.last_name} ({self.email})" def create_json_output(lis): hackers = [] @@ -73,15 +75,7 @@ class Event(db.Model): events = [] for e in lis: - events.append({ - 'id': e.id, - 'name': e.name, - 'description': e.description, - 'location': e.location, - 'start': e.start_time, - 'end': e.end_time, - 'category': e.category - }) + events.append(e.create_json()) return events @@ -93,6 +87,7 @@ class Event(db.Model): "location": self.location, "start_time": self.start_time.isoformat(), "end_time": self.end_time.isoformat(), + "category": self.category } def get_checkins(self): diff --git a/goathacks/templates/events/list.html b/goathacks/templates/events/list.html index 350cb84..f7124a5 100644 --- a/goathacks/templates/events/list.html +++ b/goathacks/templates/events/list.html @@ -65,6 +65,10 @@ {{ form.location(class="form-control") }} {{ form.location.label() }} +