Beispiel #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")
Beispiel #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)
Beispiel #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")
Beispiel #4
0
 def setUp(self):
     self.people = Person.objects.all()
     self.books = Book.objects.all()
     self.link = link_to_change(Book, 'author')
Beispiel #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")
Beispiel #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")
Beispiel #7
0
 def setUp(self):
     self.people = Person.objects.all()
     self.books = Book.objects.all()
     self.link = link_to_change(Book, "author")