Beispiel #1
0
def toggleEventNA(request, event_id):
    event = get_object_or_404(Event, pk = event_id)
    event.is_applicable = not event.is_applicable
    event.save()

    log = Log();
    desc = "Event (id=" + event_id + ") marked as "
    if (event.is_applicable):
        desc = desc + "applicable "
    else:
        desc = desc + "not applicable "
    log.description = desc;
    log.object_id = event_id
    log.action_type = Log.EVENT_UPDATE
    log.save()

    return redirect('events_list.views.index')
Beispiel #2
0
def toggleGroupNA(request, id):
    group = get_object_or_404(Group, pk = id)
    group.is_applicable = not group.is_applicable
    group.save()

    log = Log();
    desc = "Group (id=" + id + ") marked as "
    if (group.is_applicable):
        desc = desc + "applicable "
    else:
        desc = desc + "not applicable "
    log.description = desc;
    log.object_id = id
    log.action_type = Log.GROUP_UPDATE
    log.save()

    events = Event.objects.filter(group = group)
    for event in events:
        event.is_applicable = group.is_applicable
        event.save()

    return redirect('events_list.views.groupIndex')