예제 #1
0
def add_organizer(request, event_slug):
    form = RegisteredEventUserSearchForm(event_slug, request.POST or None)
    if request.POST:
        if form.is_valid():
            event_user = form.cleaned_data['eventUser']
            if event_user:
                organizer = create_organizer(event_user)
                messages.success(
                    request,
                    _("%s has been successfully added as an Organizer." % organizer.eventUser.user.username))
            return HttpResponseRedirect(reverse("add_organizer", args=[event_slug]))

        messages.error(request, _("Something went wrong (please check form errors)"))

    organizers = Organizer.objects.filter(eventUser__event__slug__iexact=event_slug)
    return render(request, 'event/organizers.html',
                  update_event_info(event_slug, request, {'form': form, 'organizers': organizers}))
예제 #2
0
def add_organizer(request, event_slug):
    form = RegisteredEventUserSearchForm(event_slug, request.POST or None)
    if request.POST:
        if form.is_valid():
            event_user = form.cleaned_data['eventUser']
            if event_user:
                organizer = create_organizer(event_user)
                messages.success(
                    request,
                    _("%s has been successfully added as an Organizer." % organizer.eventUser.user.username))
            return HttpResponseRedirect(reverse("add_organizer", args=[event_slug]))

        messages.error(request, _("Something went wrong (please check form errors)"))

    organizers = Organizer.objects.filter(eventUser__event__slug__iexact=event_slug)
    return render(request, 'event/organizers.html',
                  update_event_info(event_slug, {'form': form, 'organizers': organizers}))
예제 #3
0
def add_registration_people(request, event_slug):
    form = RegisteredEventUserSearchForm(event_slug, request.POST or None)
    if request.POST:
        if form.is_valid():
            event_user = form.cleaned_data['eventUser']
            if event_user:
                Collaborator.objects.get_or_create(eventUser=event_user)
                add_attendance_permission(event_user.user)
                messages.success(request,
                                 _("%s has been successfully added to manage attendance." % event_user.user.username))
            return HttpResponseRedirect(reverse("add_registration_people", args=[event_slug]))

        messages.error(request, _("Something went wrong (please check form errors)"))

    if Permission.objects.filter(codename='can_take_attendance').exists():
        permission = Permission.objects.get(codename='can_take_attendance')
        registration_people = Collaborator.objects.filter(eventUser__user__user_permissions=permission,
                                                          eventUser__event__slug__iexact=event_slug)
    else:
        registration_people = []

    return render(request, 'event/registration_people.html',
                  update_event_info(event_slug, request, {'form': form, 'registration_people': registration_people}))
예제 #4
0
def add_registration_people(request, event_slug):
    form = RegisteredEventUserSearchForm(event_slug, request.POST or None)
    if request.POST:
        if form.is_valid():
            event_user = form.cleaned_data['eventUser']
            if event_user:
                Collaborator.objects.get_or_create(eventUser=event_user)
                add_attendance_permission(event_user.user)
                messages.success(request,
                                 _("%s has been successfully added to manage attendance." % event_user.user.username))
            return HttpResponseRedirect(reverse("add_registration_people", args=[event_slug]))

        messages.error(request, _("Something went wrong (please check form errors)"))

    if Permission.objects.filter(codename='can_take_attendance').exists():
        permission = Permission.objects.get(codename='can_take_attendance')
        registration_people = Collaborator.objects.filter(eventUser__user__user_permissions=permission,
                                                          eventUser__event__slug__iexact=event_slug)
    else:
        registration_people = []

    return render(request, 'event/registration_people.html',
                  update_event_info(event_slug, {'form': form, 'registration_people': registration_people}))