[Answer]-Django queryset returning incorrect data?

1👍

Django (I have no experience of non-rel) caches the related objects queryset. You can avoid this by refetching the instance from the database.

instance = Lesson.objects.get(pk=form.instance.id)
len(instance.lessonstep_set.all())

Leave a comment