Example #1
0
def event_approve(request, event_id, event_slug, location_slug=None):
	location = get_location(location_slug)
	if not request.method == 'POST':
		return HttpResponseRedirect('/404')
	location_event_admin = EventAdminGroup.objects.get(location=location)
	if request.user not in location_event_admin.users.all():
		return HttpResponseRedirect('/404')

	event = Event.objects.get(id=event_id)

	event.status = Event.READY
	event.save()
	if request.user in location_event_admin.users.all():
		user_is_event_admin = True
	else:
		user_is_event_admin = False
	if request.user in event.organizers.all():
		user_is_organizer = True
	else:
		user_is_organizer = False
	msg_success = "Success! The event has been approved."

	# notify the event organizers
	event_approved_notification(event)

	return render(request, "snippets/event_status_area.html", {'event': event, 'user_is_organizer': user_is_organizer, 'user_is_event_admin': user_is_event_admin})
Example #2
0
def event_approve(request, event_id, event_slug, location_slug=None):
	location = get_object_or_404(Location, slug=location_slug)
	location_event_admin = EventAdminGroup.objects.get(location=location)
	if request.user not in location_event_admin.users.all():
		return HttpResponseRedirect('/404')
	event = Event.objects.get(id=event_id)
	if not (request.user.is_authenticated() and (request.user in event.organizers.all() or request.user in event.location.house_admins.all())):
		return HttpResponseRedirect("/")

	event.status = Event.READY
	event.save()
	if request.user in location_event_admin.users.all():
		user_is_event_admin = True
	else:
		user_is_event_admin = False
	if request.user in event.organizers.all():
		user_is_organizer = True
	else:
		user_is_organizer = False

	msg_success = "Success! The event has been approved."
	messages.add_message(request, messages.INFO, msg_success)

	# notify the event organizers and admins
	event_approved_notification(event, location)

	return HttpResponseRedirect(reverse('gather_view_event', args=(location.slug, event.id, event.slug)))
Example #3
0
def event_approve(request, event_id, event_slug, location_slug=None):
    location = get_object_or_404(Location, slug=location_slug)
    if not request.method == 'POST':
        return HttpResponseRedirect('/404')
    location_event_admin = EventAdminGroup.objects.get(location=location)
    if request.user not in location_event_admin.users.all():
        return HttpResponseRedirect('/404')

    event = Event.objects.get(id=event_id)

    event.status = Event.READY
    event.save()
    if request.user in location_event_admin.users.all():
        user_is_event_admin = True
    else:
        user_is_event_admin = False
    if request.user in event.organizers.all():
        user_is_organizer = True
    else:
        user_is_organizer = False
    msg_success = "Success! The event has been approved."

    # notify the event organizers
    event_approved_notification(event, location)

    return render(
        request, "snippets/event_status_area.html", {
            'event': event,
            'user_is_organizer': user_is_organizer,
            'user_is_event_admin': user_is_event_admin
        })
Example #4
0
def event_approve(request, event_id, event_slug, location_slug=None):
    location = get_object_or_404(Location, slug=location_slug)
    location_event_admin = EventAdminGroup.objects.get(location=location)
    if request.user not in location_event_admin.users.all():
        return HttpResponseRedirect('/404')
    event = Event.objects.get(id=event_id)
    if not (request.user.is_authenticated() and (request.user in event.organizers.all() or request.user in event.location.house_admins.all())):
        return HttpResponseRedirect("/")

    event.status = Event.READY
    event.save()
    if request.user in location_event_admin.users.all():
        user_is_event_admin = True
    else:
        user_is_event_admin = False
    if request.user in event.organizers.all():
        user_is_organizer = True
    else:
        user_is_organizer = False

    msg_success = "Success! The event has been approved."
    messages.add_message(request, messages.INFO, msg_success)

    # notify the event organizers and admins
    event_approved_notification(event, location)

    return HttpResponseRedirect(reverse('gather_view_event', args=(location.slug, event.id, event.slug)))