Beispiel #1
0
    def test_replace_veranstalter(self):
        # when
        Person.replace_veranstalter(self.p4, self.p3)

        # then
        self.assertFalse(Person.veranstaltungen(self.p4).exists())
        self.assertEqual(Person.veranstaltungen(self.p3).count(), 1)
        self.assertEqual(AlternativVorname.objects.get().vorname, self.p4.vorname)
        self.assertEqual(AlternativVorname.objects.get().person, self.p3)
Beispiel #2
0
    def post(self, request, *args, **kwargs):
        id_old = request.POST['id_old']
        id_new = request.POST['id_new']

        old_person = Person.objects.get(pk=id_old)
        new_person = Person.objects.get(pk=id_new)

        Person.replace_veranstalter(new_person, old_person)
        if not Person.is_veranstalter(new_person):
            new_person.delete()

        return HttpResponseRedirect(reverse('import_vv_edit_users'))