(self)
| 1386 | self.assertEqual(book.pubdate_year, book.pubdate.year) |
| 1387 | |
| 1388 | def test_alias_after_annotation(self): |
| 1389 | qs = Book.objects.annotate( |
| 1390 | is_book=Value(1), |
| 1391 | ).alias(is_book_alias=F("is_book")) |
| 1392 | book = qs.first() |
| 1393 | self.assertIs(hasattr(book, "is_book"), True) |
| 1394 | self.assertIs(hasattr(book, "is_book_alias"), False) |
| 1395 | |
| 1396 | def test_overwrite_annotation_with_alias(self): |
| 1397 | qs = Book.objects.annotate(is_book=Value(1)).alias(is_book=F("is_book")) |