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