Skip to content

Prep for Django 5.0 #552

@jamienoss

Description

@jamienoss

Hi, here's a heads up on a future issue that I just stumbled upon. I have no idea about the full extent but do at least know of one change in Django 5.0 that will break sql-explorer.

The passing of unsaved model instances to related filters will be fully deprecated see https://github.com/django/django/pull/16432.

This breaks at least the following code in this package (views.utils) when using the Playground:

user = request.user
is_favorite = False
if user.is_authenticated:
  is_favorite = QueryFavorite.objects.filter(user=user, query=query).exists()

QueryFavorite.objects.filter(user=user) is ok, however, QueryFavorite.objects.filter(query=query) isn't and raises ValueError("Model instances passed to related filters must be saved.") because query isn't saved and therefore has no pk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions