Ejemplo n.º 1
0
    def test_are_there_contacts_for_a_person_when_bounced(self):
        felipe = Person.objects.get(name="Felipe")
        for contact in felipe.contact_set.all():
            contact.is_bounced = True
            contact.save()

        result = Contact.are_there_contacts_for(felipe)
        self.assertFalse(result)
Ejemplo n.º 2
0
    def test_are_there_contacts_for_a_person_when_bounced(self):
        felipe = Person.objects.get(name="Felipe")
        for contact in felipe.contact_set.all():
            contact.is_bounced = True
            contact.save()

        result = Contact.are_there_contacts_for(felipe)
        self.assertFalse(result)
Ejemplo n.º 3
0
 def render_option(self, selected_choices, option_value, option_label):
     person = Person.objects.get(id=option_value)
     contacts_exist = Contact.are_there_contacts_for(person)
     if not contacts_exist:
         option_label += u" *"
     option_value = force_text(option_value)
     if option_value in selected_choices:
         selected_html = mark_safe(u' selected="selected"')
         # I copied this from the original SelectMultiple
         # but this lines of code is not being used currently
         # for this reason the following lines of code are comented
         # if not self.allow_multiple_selected:
         #     # Only allow for a single selection.
         #     selected_choices.remove(option_value)
     else:
         selected_html = ''
     return format_html(u'<option value="{0}"{1}>{2}</option>',
                        option_value, selected_html,
                        force_text(option_label))
Ejemplo n.º 4
0
 def render_option(self, selected_choices, option_value, option_label):
     person = Person.objects.get(id=option_value)
     contacts_exist = Contact.are_there_contacts_for(person)
     if not contacts_exist:
         option_label += u" *"
     option_value = force_text(option_value)
     if option_value in selected_choices:
         selected_html = mark_safe(u' selected="selected"')
         # I copied this from the original SelectMultiple
         # but this lines of code is not being used currently
         # for this reason the following lines of code are comented
         # if not self.allow_multiple_selected:
         #     # Only allow for a single selection.
         #     selected_choices.remove(option_value)
     else:
         selected_html = ''
     return format_html(u'<option value="{0}"{1}>{2}</option>',
                        option_value,
                        selected_html,
                        force_text(option_label))
Ejemplo n.º 5
0
    def test_are_there_contacts_for_a_person_when_empty(self):
        felipe = Person.objects.get(name="Felipe")
        felipe.contact_set.all().delete()

        result = Contact.are_there_contacts_for(felipe)
        self.assertFalse(result)
Ejemplo n.º 6
0
    def test_are_there_contacts_for_a_person_when_non_empty(self):
        felipe = Person.objects.get(name="Felipe")

        result = Contact.are_there_contacts_for(felipe)
        self.assertTrue(result)
Ejemplo n.º 7
0
    def test_are_there_contacts_for_a_person_when_empty(self):
        felipe = Person.objects.get(name="Felipe")
        felipe.contact_set.all().delete()

        result = Contact.are_there_contacts_for(felipe)
        self.assertFalse(result)
Ejemplo n.º 8
0
    def test_are_there_contacts_for_a_person_when_non_empty(self):
        felipe = Person.objects.get(name="Felipe")

        result = Contact.are_there_contacts_for(felipe)
        self.assertTrue(result)