Exemple #1
0
def event_publish(request, event_id, event_slug, location_slug=None):
	if not request.method == 'POST':
		return HttpResponseRedirect('/404')
	location = get_location(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)

	print request.POST
	event.status = Event.LIVE
	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 published."

	# notify the event organizers and admins
	event_published_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})
Exemple #2
0
def event_publish(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("/")

	print request.POST
	event.status = Event.LIVE
	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 published."
	messages.add_message(request, messages.INFO, msg_success)

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

	return HttpResponseRedirect(reverse('gather_view_event', args=(location.slug, event.id, event.slug)))
Exemple #3
0
def event_publish(request, event_id, event_slug, location_slug=None):
    if not request.method == 'POST':
        return HttpResponseRedirect('/404')
    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)

    print request.POST
    event.status = Event.LIVE
    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 published."

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

    return render(
        request, "snippets/event_status_area.html", {
            'location': location,
            'event': event,
            'user_is_organizer': user_is_organizer,
            'user_is_event_admin': user_is_event_admin
        })
Exemple #4
0
def event_publish(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)

    event = Event.objects.get(id=event_id)
    if (request.user not in location_event_admin.users.all() and
        request.user not in event.location.house_admins.all() and
        request.user not in event.organizers.all()):
        print 'user does not have correct permissions to publish event'
        return HttpResponseRedirect('/404')

    print request.POST
    event.status = Event.LIVE
    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 published."
    messages.add_message(request, messages.INFO, msg_success)

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

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