Beispiel #1
0
def update_timetable_entry(entry, data):
    entry.populate_from_dict(data)
    object_type, object_title = _get_object_info(entry)
    db.session.flush()
    signals.event.timetable_entry_updated.send(entry)
    logger.info('Timetable entry %s updated by %s', entry, session.user)
    entry.event_new.log(EventLogRealm.management, EventLogKind.change, 'Timetable',
                        "Entry for {} '{}' modified".format(object_type, object_title), session.user,
                        data={'Time': format_datetime(entry.start_dt)})
Beispiel #2
0
def update_timetable_entry(entry, data):
    changes = entry.populate_from_dict(data)
    object_type, object_title = _get_object_info(entry)
    db.session.flush()
    if changes:
        signals.event.timetable_entry_updated.send(entry, changes=changes)
        logger.info('Timetable entry %s updated by %s', entry, session.user)
        entry.event.log(EventLogRealm.management, EventLogKind.change, 'Timetable',
                        "Entry for {} '{}' modified".format(object_type, object_title), session.user,
                        data={'Time': format_datetime(entry.start_dt)})
Beispiel #3
0
def delete_timetable_entry(entry, log=True):
    object_type, object_title = _get_object_info(entry)
    signals.event.timetable_entry_deleted.send(entry)
    entry.object = None
    db.session.flush()
    if log:
        logger.info('Timetable entry %s deleted by %s', entry, session.user)
        entry.event.log(EventLogRealm.management, EventLogKind.negative, 'Timetable',
                        "Entry for {} '{}' deleted".format(object_type, object_title), session.user,
                        data={'Time': format_datetime(entry.start_dt)})
Beispiel #4
0
def delete_timetable_entry(entry, log=True):
    object_type, object_title = _get_object_info(entry)
    signals.event.timetable_entry_deleted.send(entry)
    entry.object = None
    db.session.flush()
    if log:
        logger.info('Timetable entry %s deleted by %s', entry, session.user)
        entry.event_new.log(EventLogRealm.management, EventLogKind.negative, 'Timetable',
                            "Entry for {} '{}' deleted".format(object_type, object_title), session.user,
                            data={'Time': format_datetime(entry.start_dt)})
Beispiel #5
0
def create_timetable_entry(event, data, parent=None, extend_parent=False):
    entry = TimetableEntry(event_new=event, parent=parent)
    entry.populate_from_dict(data)
    object_type, object_title = _get_object_info(entry)
    db.session.flush()
    signals.event.timetable_entry_created.send(entry)
    logger.info('Timetable entry %s created by %s', entry, session.user)
    entry.event_new.log(EventLogRealm.management, EventLogKind.positive, 'Timetable',
                        "Entry for {} '{}' created".format(object_type, object_title), session.user,
                        data={'Time': format_datetime(entry.start_dt)})
    if extend_parent:
        entry.extend_parent()
    return entry
Beispiel #6
0
def create_timetable_entry(event, data, parent=None, extend_parent=False):
    entry = TimetableEntry(event_new=event, parent=parent)
    entry.populate_from_dict(data)
    object_type, object_title = _get_object_info(entry)
    db.session.flush()
    signals.event.timetable_entry_created.send(entry)
    logger.info('Timetable entry %s created by %s', entry, session.user)
    entry.event_new.log(EventLogRealm.management, EventLogKind.positive, 'Timetable',
                        "Entry for {} '{}' created".format(object_type, object_title), session.user,
                        data={'Time': format_datetime(entry.start_dt)})
    if extend_parent:
        entry.extend_parent()
    return entry