def _process_DELETE(self): """Delete a timetable entry""" if self.entry.type == TimetableEntryType.SESSION_BLOCK: delete_session_block(self.entry.session_block) elif self.event.type != 'conference' and self.entry.type == TimetableEntryType.CONTRIBUTION: delete_contribution(self.entry.contribution) else: delete_timetable_entry(self.entry)
def _process(self): for contrib in self.contribs: delete_contribution(contrib) deleted_count = len(self.contribs) flash( ngettext("The contribution has been deleted.", "{count} contributions have been deleted.", deleted_count).format(count=deleted_count), 'success') return jsonify_data(**self.list_generator.render_list())
def delete_abstract(abstract, delete_contrib=False): abstract.is_deleted = True contrib = abstract.contribution abstract.contribution = None if delete_contrib and contrib: delete_contribution(contrib) db.session.flush() signals.event.abstract_deleted.send(abstract) logger.info('Abstract %s deleted by %s', abstract, session.user) abstract.event.log(EventLogRealm.management, EventLogKind.negative, 'Abstracts', 'Abstract {} deleted'.format(abstract.verbose_title), session.user)
def withdraw_abstract(abstract): abstract.reset_state() abstract.state = AbstractState.withdrawn contrib = abstract.contribution abstract.contribution = None if contrib: delete_contribution(contrib) db.session.flush() signals.event.abstract_state_changed.send(abstract) logger.info('Abstract %s withdrawn by %s', abstract, session.user) abstract.event.log(EventLogRealm.management, EventLogKind.negative, 'Abstracts', 'Abstract {} withdrawn'.format(abstract.verbose_title), session.user)
def delete_session_block(session_block): from fossir.modules.events.contributions.operations import delete_contribution from fossir.modules.events.timetable.operations import delete_timetable_entry session_ = session_block.session unschedule_contribs = session_.event.type_ == EventType.conference for contribution in session_block.contributions[:]: contribution.session_block = None if unschedule_contribs: delete_timetable_entry(contribution.timetable_entry, log=False) else: delete_contribution(contribution) for entry in session_block.timetable_entry.children[:]: delete_timetable_entry(entry, log=False) delete_timetable_entry(session_block.timetable_entry, log=False) signals.event.session_block_deleted.send(session_block) if session_block in session_.blocks: session_.blocks.remove(session_block) if not session_.blocks and session_.event.type != 'conference': delete_session(session_) db.session.flush() logger.info('Session block %s deleted by %s', session_block, session.user)
def _process_DELETE(self): delete_contribution(self.contrib) flash( _("Contribution '{}' successfully deleted").format( self.contrib.title), 'success') return jsonify_data(**self.list_generator.render_list())