def event_microlocation_new(self, event_id):
     """New Microlocation view"""
     events = DataGetter.get_all_events()
     form = MicrolocationForm()
     self.name = "Microlocation | New"
     if form.validate():
         if is_event_admin_or_editor(event_id):
             DataManager.create_microlocation(form, event_id)
             flash("Microlocation added")
         else:
             flash("You don't have permission!")
         return redirect(url_for('.event_microlocations', event_id=event_id))
     return self.render('admin/model/create_microlocation.html',
                        form=form,
                        event_id=event_id,
                        events=events,
                        cancel_url=url_for('.event_microlocations', event_id=event_id))
 def event_microlocation_edit(self, event_id, microlocation_id):
     """Edit Microlocation view"""
     microlocation = DataGetter.get_object(Microlocation, microlocation_id)
     events = DataGetter.get_all_events()
     form = MicrolocationForm(obj=microlocation)
     self.name = "Microlocation " + microlocation_id + " | Edit"
     if form.validate():
         if is_event_admin_or_editor(event_id):
             DataManager.update_microlocation(form, microlocation)
             flash("Microlocation updated")
         else:
             flash("You don't have permission!")
         return redirect(url_for('.event_microlocations', event_id=event_id))
     return self.render('admin/model/create_microlocation.html',
                        form=form,
                        event_id=event_id,
                        events=events,
                        cancel_url=url_for('.event_microlocations', event_id=event_id))
Example #3
0
 def event_microlocation_new(self, event_id):
     """New Microlocation view"""
     events = DataGetter.get_all_events()
     form = MicrolocationForm()
     self.name = "Microlocation | New"
     if form.validate():
         if is_event_admin_or_editor(event_id):
             DataManager.create_microlocation(form, event_id)
             flash("Microlocation added")
         else:
             flash("You don't have permission!")
         return redirect(url_for('.event_microlocations',
                                 event_id=event_id))
     return self.render('admin/model/create_microlocation.html',
                        form=form,
                        event_id=event_id,
                        events=events,
                        cancel_url=url_for('.event_microlocations',
                                           event_id=event_id))
Example #4
0
 def event_microlocation_edit(self, event_id, microlocation_id):
     """Edit Microlocation view"""
     microlocation = DataGetter.get_microlocation(microlocation_id)
     events = DataGetter.get_all_events()
     form = MicrolocationForm(obj=microlocation)
     self.name = "Microlocation " + microlocation_id + " | Edit"
     if form.validate():
         if is_event_admin_or_editor(event_id):
             DataManager.update_microlocation(form, microlocation)
             flash("Microlocation updated")
         else:
             flash("You don't have permission!")
         return redirect(url_for('.event_microlocations',
                                 event_id=event_id))
     return self.render('admin/model/create_microlocation.html',
                        form=form,
                        event_id=event_id,
                        events=events,
                        cancel_url=url_for('.event_microlocations',
                                           event_id=event_id))