예제 #1
0
 def event_language_new(self, event_id):
     """new Language view"""
     events = DataGetter.get_all_events()
     form = LanguageForm()
     self.name = "Language | New"
     if form.validate():
         if is_event_admin_or_editor(event_id):
             DataManager.create_language(form, event_id)
             flash("Language added")
         else:
             flash("You don't have permission!")
         return redirect(url_for('.event_languages', 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_languages', event_id=event_id))
예제 #2
0
 def event_language_new(self, event_id):
     """new Language view"""
     events = DataGetter.get_all_events()
     form = LanguageForm()
     self.name = "Language | New"
     if form.validate():
         if is_event_admin_or_editor(event_id):
             DataManager.create_language(form, event_id)
             flash("Language added")
         else:
             flash("You don't have permission!")
         return redirect(url_for('.event_languages', 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_languages',
                                           event_id=event_id))
예제 #3
0
 def event_language_edit(self, event_id, language_id):
     """Edit language view"""
     language = DataGetter.get_object(Language, language_id)
     events = DataGetter.get_all_events()
     form = LanguageForm(obj=language)
     self.name = "Language " + language_id + " | Edit"
     if form.validate():
         if is_event_admin_or_editor(event_id):
             DataManager.update_language(form, language, event_id)
             flash("Language updated")
         else:
             flash("You don't have permission!")
         return redirect(url_for('.event_languages', 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_languages', event_id=event_id))
예제 #4
0
 def event_language_edit(self, event_id, language_id):
     """Edit language view"""
     language = DataGetter.get_language(language_id)
     events = DataGetter.get_all_events()
     form = LanguageForm(obj=language)
     self.name = "Language " + language_id + " | Edit"
     if form.validate():
         if is_event_admin_or_editor(event_id):
             DataManager.update_language(form, language, event_id)
             flash("Language updated")
         else:
             flash("You don't have permission!")
         return redirect(url_for('.event_languages', 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_languages',
                                           event_id=event_id))