[TASK] Make mapping wizards success_url work.

This commit is contained in:
Jan Philipp Timme 2014-10-02 12:11:50 +02:00
parent 5df3f3f39a
commit ed20650289
1 changed files with 13 additions and 3 deletions

View File

@ -6,13 +6,13 @@ from django.core.files.storage import default_storage
from django.core.files.base import ContentFile
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect
from django.views.generic import TemplateView, FormView, CreateView, UpdateView
from django.views.generic.detail import SingleObjectMixin
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.contrib.auth.views import login, logout
from django.forms import ValidationError
from django.core.urlresolvers import reverse
from frontend.forms import NewProjectForm, FileUploadForm, PersonMapForm
@ -210,6 +210,7 @@ class ProjectPersonView(ProtectedFormView, SingleObjectMixin):
class ProjectMapPersonView(ProtectedFormView, SingleObjectMixin):
""" View containing the person mapping 'wizard'. """
template_name = u'project/map-person.html'
page_title = u'Person Mapping'
form_class = PersonMapForm
@ -218,10 +219,19 @@ class ProjectMapPersonView(ProtectedFormView, SingleObjectMixin):
def get_context_data(self, **kwargs):
project = self.object
kwargs[u'person'] = person_mapper.get_person_by_uuid(project, self.person_uuid)
return super(ProjectMapPersonView, self).get_context_data(**kwargs)
def get_success_url(self):
unmapped_persons = person_mapper.get_unmapped_identities(self.object)
project_id = self.object.id
person = unmapped_persons.itervalues().next()
kwargs = {
u"project_id": project_id,
u"person_uuid": person.ID
}
return reverse('frontend-project-map-person', kwargs=kwargs)
def get(self, request, *args, **kwargs):
self.project_id = kwargs[u'project_id']
self.person_uuid = kwargs[u'person_uuid']