Esempio n. 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)
Esempio n. 2
0
    def get_context_data(self, **kwargs):
        context = super(SimilarNamesView, self).get_context_data(**kwargs)
        context['new_vorname'] = self.object.vorname
        context['new_nachname'] = self.object.nachname

        vorname = context['new_vorname'].split(' ')[0]
        nachname = context['new_nachname']

        context['similar_person'] = Person.persons_with_similar_names(
            vorname, nachname)
        context['old_veranstaltungen'] = Person.veranstaltungen(
            context['similar_person'])
        context['new_veranstaltungen'] = Person.veranstaltungen(
            context['person_new'])
        return context
Esempio n. 3
0
 def test_veranstaltungen(self):
     veranstaltungen = Person.veranstaltungen(self.p1)
     veranstalter_name = veranstaltungen.filter(veranstalter=self.p1)[0].veranstalter.get().full_name()
     self.assertEqual(veranstaltungen.count(), 1)
     self.assertEqual(self.p1.full_name(), veranstalter_name)