Django QuerySet Not Reflecting Changes in Related Model After Inline Form Save
Hey everyone, I'm running into an issue that's driving me crazy... I'm encountering an issue where changes made to a related model via an inline form in the Django admin aren't being reflected in the original model's QuerySet. I'm using Django 3.2.9 and have set up an inline model admin for a `Profile` model that is related to a `User` model. Here's a simplified version of my models: ```python from django.db import models from django.contrib.auth.models import User class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) bio = models.TextField(blank=True) class UserAdmin(admin.ModelAdmin): inlines = [ProfileInline] class ProfileInline(admin.TabularInline): model = Profile ``` When I try to update the `bio` field for a user through the admin interface, the changes save correctly, but when I query the `Profile` objects afterwards, they appear to remain unchanged. For instance: ```python user = User.objects.get(username='testuser') print(user.profile.bio) # This still prints the old bio ``` I have confirmed that the save method is being called, and I even tried overriding the `save_model` method in the `ProfileInline` to add some logging: ```python def save_model(self, request, obj, form, change): super().save_model(request, obj, form, change) print('Saved:', obj.bio) ``` The log confirms that the new bio is being saved, but the QuerySet still returns the old value. I've also tried manually refreshing the instance using `refresh_from_db()`, but that didn't help. Has anyone experienced this before? Is there something I'm missing in the way Django handles the caching of QuerySets or related objects? Any insights would be greatly appreciated! I'm working on a API that needs to handle this. Any ideas what could be causing this? Thanks for taking the time to read this! This is my first time working with Python stable. Hoping someone can shed some light on this.