Django 4.1 scenarios when using custom query for related field in ModelAdmin
I'm working with an scenario with my Django admin where I'm trying to customize the display of a related field in a ModelAdmin class. I have a `Book` model that has a ForeignKey relationship with an `Author` model. I want to show the author's full name in the admin list view, but when I override the `get_queryset` method in the `BookAdmin` class to include a custom query, I receive the following behavior: `RelatedObjectDoesNotExist: Author has no related Book`. Hereβs what my models look like: ```python class Author(models.Model): first_name = models.CharField(max_length=100) last_name = models.CharField(max_length=100) def __str__(self): return f'{self.first_name} {self.last_name}' class Book(models.Model): title = models.CharField(max_length=200) author = models.ForeignKey(Author, on_delete=models.CASCADE, related_name='books') ``` And hereβs how I have set up my `BookAdmin` class: ```python from django.contrib import admin class BookAdmin(admin.ModelAdmin): list_display = ('title', 'author_full_name') def author_full_name(self, obj): return str(obj.author) author_full_name.short_description = 'Author' def get_queryset(self, request): qs = super().get_queryset(request) return qs.select_related('author') ``` I've tried removing the `get_queryset` method and using the default, which works without errors, but I really need the performance improvement from `select_related`. Is there something I'm missing or a better way to achieve this without triggering the `RelatedObjectDoesNotExist` behavior?