Ticket #26524: 26524-regress.diff

File 26524-regress.diff, 1.4 KB (added by Tim Graham, 7 years ago)
  • tests/admin_views/models.py

    diff --git a/tests/admin_views/models.py b/tests/admin_views/models.py
    index 8828c8b..4d500cd 100644
    a b class CyclicTwo(models.Model):  
    596596        return self.name
    597597
    598598
     599@python_2_unicode_compatible
    599600class Topping(models.Model):
    600601    name = models.CharField(max_length=20)
    601602
     603    def __str__(self):
     604        return self.name
     605
    602606
    603607class Pizza(models.Model):
    604608    name = models.CharField(max_length=20)
  • tests/admin_views/tests.py

    diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
    index 3368ddf..a9d4d0d 100644
    a b class ReadonlyTest(AdminFieldExtractionMixin, TestCase):  
    46964696        response = self.client.get(reverse('admin:admin_views_topping_add'))
    46974697        self.assertEqual(response.status_code, 200)
    46984698
     4699    def test_readonly_manytomany_forwards_ref(self):
     4700        topping = Topping.objects.create(name='Salami')
     4701        pizza = Pizza.objects.create(name='Americano')
     4702        pizza.toppings.add(topping)
     4703        response = self.client.get(reverse('admin:admin_views_pizza_change', args=(pizza.pk,)))
     4704        self.assertContains(response,'<label>Toppings:</label>')
     4705        self.assertContains(response, '<p>Salami</p>', html=True)
     4706
    46994707    def test_readonly_onetoone_backwards_ref(self):
    47004708        """
    47014709        Can reference a reverse OneToOneField in ModelAdmin.readonly_fields.
Back to Top