def event_level_new(self, event_id):
     events = DataGetter.get_all_events()
     form = LevelForm()
     self.name = "Level | New"
     if form.validate():
         if is_event_admin_or_editor(event_id):
             DataManager.create_level(form, event_id)
             flash("Level added")
         else:
             flash("You don't have permission!")
         return redirect(url_for('.event_levels', event_id=event_id))
     return self.render('admin/model/create_model.html',
                        form=form,
                        event_id=event_id,
                        events=events,
                        cancel_url=url_for('.event_levels', event_id=event_id))
Exemple #2
0
 def event_level_new(self, event_id):
     events = DataGetter.get_all_events()
     form = LevelForm()
     self.name = "Level | New"
     if form.validate():
         if is_event_admin_or_editor(event_id):
             DataManager.create_level(form, event_id)
             flash("Level added")
         else:
             flash("You don't have permission!")
         return redirect(url_for('.event_levels', event_id=event_id))
     return self.render('admin/model/create_model.html',
                        form=form,
                        event_id=event_id,
                        events=events,
                        cancel_url=url_for('.event_levels',
                                           event_id=event_id))
 def event_level_edit(self, event_id, level_id):
     """Edit level view"""
     level = DataGetter.get_object(Level, level_id)
     events = DataGetter.get_all_events()
     form = LevelForm(obj=level)
     self.name = "Level " + level_id + " | Edit"
     if form.validate():
         if is_event_admin_or_editor(event_id):
             DataManager.update_level(form, level, event_id)
             flash("Level updated")
         else:
             flash("You don't have permission!")
         return redirect(url_for('.event_levels', event_id=event_id))
     return self.render('admin/model/create_model.html',
                        form=form,
                        event_id=event_id,
                        events=events,
                        cancel_url=url_for('.event_levels', event_id=event_id))
Exemple #4
0
 def event_level_edit(self, event_id, level_id):
     """Edit level view"""
     level = DataGetter.get_level(level_id)
     events = DataGetter.get_all_events()
     form = LevelForm(obj=level)
     self.name = "Level " + level_id + " | Edit"
     if form.validate():
         if is_event_admin_or_editor(event_id):
             DataManager.update_level(form, level, event_id)
             flash("Level updated")
         else:
             flash("You don't have permission!")
         return redirect(url_for('.event_levels', event_id=event_id))
     return self.render('admin/model/create_model.html',
                        form=form,
                        event_id=event_id,
                        events=events,
                        cancel_url=url_for('.event_levels',
                                           event_id=event_id))