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