Beispiel #1
0
def event_edit(request, event):
    if request.method == 'POST':
        form = EventForm(request.POST, instance=event)
        if form.is_valid():
            event = form.save()
    else:
        form = EventForm(instance=event)
    return render(request, 'affiliates/event/edit.html', {
        'organization': event.organization,
        'event': event,
        'form': form,
    })
Beispiel #2
0
def create_event(request, organization):
    if request.method == 'POST':
        form = EventForm(request.POST)
        if form.is_valid():
            event = organization.create_event(
                form.save(commit=False),
                request.user,
            )
            return HttpResponseRedirect(reverse(
                'affiliates.views.event_edit',
                args=[organization.code, event.id]
            ))
    else:
        form = EventForm()
    return render(request, 'affiliates/create_event.html', {
        'organization': organization,
        'form': form,
    })