def event_track_new(self, event_id):
     """New track view"""
     events = DataGetter.get_all_events()
     form = TrackForm(request.form)
     self.name = " Track | New"
     if form.validate():
         if is_event_admin_or_editor(event_id) and is_track_name_unique_in_event(form, event_id):
             DataManager.create_track(form, event_id)
             flash("Track added")
         else:
             flash("You don't have permission!")
         return redirect(url_for('.event_tracks', 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_tracks', event_id=event_id))
 def event_track_edit(self, event_id, track_id):
     """Edit track view"""
     track = DataGetter.get_object(Track, track_id)
     events = DataGetter.get_all_events()
     form = TrackForm(obj=track)
     self.name = "Track | Edit"
     if form.validate() and is_track_name_unique_in_event(form, event_id, track_id):
         if is_event_admin_or_editor(event_id):
             DataManager.update_track(form, track)
             flash("Track updated")
         else:
             flash("You don't have permission!")
         return redirect(url_for('.event_tracks', 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_tracks', event_id=event_id))
Beispiel #3
0
 def event_track_edit(self, event_id, track_id):
     """Edit track view"""
     track = DataGetter.get_track(track_id)
     events = DataGetter.get_all_events()
     form = TrackForm(obj=track)
     self.name = "Track | Edit"
     if form.validate() and is_track_name_unique_in_event(
             form, event_id, track_id):
         if is_event_admin_or_editor(event_id):
             DataManager.update_track(form, track)
             flash("Track updated")
         else:
             flash("You don't have permission!")
         return redirect(url_for('.event_tracks', 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_tracks',
                                           event_id=event_id))
Beispiel #4
0
 def event_track_new(self, event_id):
     """New track view"""
     events = DataGetter.get_all_events()
     form = TrackForm(request.form)
     self.name = " Track | New"
     if form.validate():
         if is_event_admin_or_editor(
                 event_id) and is_track_name_unique_in_event(
                     form, event_id):
             DataManager.create_track(form, event_id)
             flash("Track added")
         else:
             flash("You don't have permission!")
         return redirect(url_for('.event_tracks', 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_tracks',
                                           event_id=event_id))