Exemplo n.º 1
0
def event(request,eventId):
    event = get_object_or_404(Event,pk=eventId)
    rules = event.eventattendancerule_set.all()
    admit_rules, deny_rules = EventAttendanceRule.separate(rules)

    new_rule = EventAttendanceRule()
    new_rule.event = event
    new_rule_form = NewEventRuleForm(instance=new_rule)

    invite_list = event.eventattendanceperson_set.all()

    messages = dict((o.pk,o) for o in AdmitMessage.objects.all())

    flag = ""
    if request.GET.get('flag'):
        flag = request.GET.get('flag')
    
    return render_to_response('scanner/manage/event.html',{
                                                                'event': event,
                                                                'admit': admit_rules,
                                                                'deny': deny_rules,
                                                                'new_rule_form': new_rule_form,
                                                                'invite_list': invite_list,
                                                                'flag': flag,
                                                                'messages': messages,
                                                            },
                              context_instance=RequestContext(request))
Exemplo n.º 2
0
def newEventRule(request,eventId):
    event = get_object_or_404(Event,pk=eventId)
    new_rule = EventAttendanceRule()
    new_rule.event = event
    #TODO: if we add better auth, make sure we check that the user can edit the event's rules before saving

    form = NewEventRuleForm(request.POST,instance=new_rule)
    if form.is_valid():
        form.save()
    else:
        print form.errors
    return HttpResponseRedirect(reverse('scanner.views.event',kwargs={'eventId': event.pk}) + "?flag=rule_added")