docs: def edit_event_view(request, event_pk):
      ''' The view to edit an event. '''
      page_name = "Edit Event"
      profile = UserProfile.objects.get(user=request.user)
      event = get_object_or_404(Event, pk=event_pk)
  
      if event.owner != profile and not request.user.is_superuser:
          return HttpResponseRedirect(
              reverse('events:view', kwargs={"event_pk": event_pk}),
          )
  
      event_form = EventForm(
          request.POST or None,
          profile=profile,
          instance=event,
      )
      if event_form.is_valid():
          event = event_form.save()
          messages.add_message(
              request, messages.SUCCESS,
              MESSAGES['EVENT_UPDATED'].format(event=event.title),
          )
          return HttpResponseRedirect(
              reverse('events:view', kwargs={"event_pk": event_pk}),
          )
  
      return render_to_response('edit_event.html', {
          'page_name': page_name,
          'event_form': event_form,
      }, context_instance=RequestContext(request))