Repository: graphql-python/graphene-django

Issue:
DjangoListField returning stale data by default
https://repl.it/talk/share/DjangoListField-bug/79205
Idk if this is the correct way of sharing the repl, if not, lmk

Repro:
1. Create superuser
2. In one tab, run query
```py
{
  allRecipes {
    id
    title
    instructions
  }
}
```
3. In another tab, go to admin panel, add new record to recipes
4. Rerun the above query

You'll see that the data returned does not include the new recipe that was added


Discussion:
I am able to reproduce on the repl.it environment but I feel like the environment might be sus. Are you seeing this outside the repl.it environment?

Anyhow, it shouldn't be too difficult to add a unit test for this. I have similar tests in my own project but they are based on DjangoFilterConnectionField
Yes, I'm seeing the same behaviour in my local django project
Alrighty, I'll work to add a test for that tomorrow. Thanks for bringing this up

Resolving patch:
diff --git a/graphene_django/fields.py b/graphene_django/fields.py
--- a/graphene_django/fields.py
+++ b/graphene_django/fields.py
@@ -43,16 +43,16 @@ def _underlying_type(self):
     def model(self):
         return self._underlying_type._meta.model
 
-    def get_default_queryset(self):
-        return self.model._default_manager.get_queryset()
+    def get_manager(self):
+        return self.model._default_manager
 
     @staticmethod
     def list_resolver(
-        django_object_type, resolver, default_queryset, root, info, **args
+        django_object_type, resolver, default_manager, root, info, **args
     ):
         queryset = maybe_queryset(resolver(root, info, **args))
         if queryset is None:
-            queryset = default_queryset
+            queryset = maybe_queryset(default_manager)
 
         if isinstance(queryset, QuerySet):
             # Pass queryset to the DjangoObjectType get_queryset method
@@ -66,10 +66,7 @@ def get_resolver(self, parent_resolver):
             _type = _type.of_type
         django_object_type = _type.of_type.of_type
         return partial(
-            self.list_resolver,
-            django_object_type,
-            parent_resolver,
-            self.get_default_queryset(),
+            self.list_resolver, django_object_type, parent_resolver, self.get_manager(),
         )
 
 


Test patch:
diff --git a/graphene_django/tests/test_fields.py b/graphene_django/tests/test_fields.py
--- a/graphene_django/tests/test_fields.py
+++ b/graphene_django/tests/test_fields.py
@@ -75,6 +75,39 @@ class Query(ObjectType):
             "reporters": [{"firstName": "Tara"}, {"firstName": "Debra"}]
         }
 
+    def test_list_field_queryset_is_not_cached(self):
+        class Reporter(DjangoObjectType):
+            class Meta:
+                model = ReporterModel
+                fields = ("first_name",)
+
+        class Query(ObjectType):
+            reporters = DjangoListField(Reporter)
+
+        schema = Schema(query=Query)
+
+        query = """
+            query {
+                reporters {
+                    firstName
+                }
+            }
+        """
+
+        result = schema.execute(query)
+        assert not result.errors
+        assert result.data == {"reporters": []}
+
+        ReporterModel.objects.create(first_name="Tara", last_name="West")
+        ReporterModel.objects.create(first_name="Debra", last_name="Payne")
+
+        result = schema.execute(query)
+
+        assert not result.errors
+        assert result.data == {
+            "reporters": [{"firstName": "Tara"}, {"firstName": "Debra"}]
+        }
+
     def test_override_resolver(self):
         class Reporter(DjangoObjectType):
             class Meta: