Skip to content

Commit

Permalink
Add method to get form
Browse files Browse the repository at this point in the history
  • Loading branch information
SegiNyn authored and ThiefMaster committed Nov 8, 2022
1 parent a7cfd86 commit 58c1ced
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,16 @@ def _process(self):
class RHModifySession(RHManageSessionBase):
"""Modify a session."""

def render_form(self, form):
return jsonify_form(form)

def _process(self):
form = SessionForm(obj=self.session, event=self.event)
if form.validate_on_submit():
with track_location_changes():
update_session(self.session, form.data)
return jsonify_data(html=_render_session_list(self.event))
return jsonify_form(form)
return self.render_form(form)


class RHDeleteSessions(RHManageSessionsActionsBase):
Expand Down
5 changes: 4 additions & 1 deletion indico/modules/events/timetable/controllers/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ def _process_args(self):
RHManageTimetableEntryBase._process_args(self)
self.edit_session = request.args.get('edit_session') == '1'

def render_form(self, form):
return jsonify_form(form, fields=getattr(form, '_display_fields', None))

def _process(self):
form = None
parent_session_block = self.entry.parent.object if self.entry.parent else None
Expand Down Expand Up @@ -238,7 +241,7 @@ def _process(self):
return jsonify_data(update=serialize_entry_update(self.entry, session_=self.session),
notifications=notifications, flash=False)
self.commit = False
return jsonify_form(form, fields=getattr(form, '_display_fields', None))
return self.render_form(form)


class RHLegacyTimetableEditEntryTime(RHManageTimetableEntryBase):
Expand Down

0 comments on commit 58c1ced

Please sign in to comment.