示例#1
0
def signout(request, event_id):
    cal_event = get_object_or_404(Event, pk=event_id)

    is_restricted = is_raid_restricted(cal_event)
    if not is_restricted:
        try:
            obj = Participation.objects.get(user=request.user, event=cal_event)
            obj.delete()
        except Participation.DoesNotExist:
            pass

    return HttpResponseRedirect(reverse('event', args=[event_id]))
示例#2
0
def signup(request, event_id):
    cal_event = get_object_or_404(Event, pk=event_id)

    is_restricted = is_raid_restricted(cal_event)
    if not is_restricted:
        try:
            p = Participation()
            p.event = cal_event
            p.user = request.user
            p.joined = datetime.utcnow()
            p.save()
        except IntegrityError:
            pass

    return HttpResponseRedirect(reverse('event', args=[event_id]))
示例#3
0
def event(request, event_id):
    cal_event = get_object_or_404(Event, pk=event_id)

    users = Participation.objects.filter(event=cal_event)

    is_signed = True
    try:
        Participation.objects.get(user=request.user, event=cal_event)
    except Participation.DoesNotExist:
        is_signed = False

    is_restricted = is_raid_restricted(cal_event)

    return render_to_response('maincal/event.html', {
        'page': 'event',
        'event': cal_event,
        'users': users,
        'is_signed': is_signed,
        'is_restricted': is_restricted
    }, context_instance=RequestContext(request))