Exemplo n.º 1
0
 def test_default_sets_html_for_empty_field(self):
     link = link_to_change(Book, 'author', default="Unknown author")
     self.assertEqual(link(self.books[5]).strip(), "Unknown author")
Exemplo n.º 2
0
 def _get_changelist_column(self, field):
     if isinstance(field, ForeignKey):
         return link_to_change(self.model, field.name)
     elif isinstance(field, URLField):
         return link_to_url(self.model, field.name)
Exemplo n.º 3
0
 def test_short_description_sets_short_description(self):
     link = link_to_change(Book, 'author', short_description="written by")
     self.assertEqual(link.short_description, "written by")
Exemplo n.º 4
0
 def setUp(self):
     self.people = Person.objects.all()
     self.books = Book.objects.all()
     self.link = link_to_change(Book, 'author')
Exemplo n.º 5
0
 def test_default_sets_html_for_empty_field(self):
     link = link_to_change(Book, "author", default="Unknown author")
     self.assertEqual(link(self.books[5]).strip(), "Unknown author")
Exemplo n.º 6
0
 def test_short_description_sets_short_description(self):
     link = link_to_change(Book, "author", short_description="written by")
     self.assertEqual(link.short_description, "written by")
Exemplo n.º 7
0
 def setUp(self):
     self.people = Person.objects.all()
     self.books = Book.objects.all()
     self.link = link_to_change(Book, "author")