You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
get_RELATED_order (where RELATED is the name of the first model)
set_RELATED_order
However, these methods are not recognized by django-stubs, I get an error as if I had a typo. Making the Meta class inherit from TypedModelMeta has no effect.
How is that should be
These four methods should be recognized, along with the correct type for the primary key. This means the get method returns a QuerySet of whatever type the PK is, and the set method takes an Iterable of whatever the type of the PK is. The next and previous methods return an instance of whatever their model is. They do loop around, so there will always be an object.
Bug report
What's wrong
It is possible to set the order of model instances relative to some other model (such as order of answers to a question in a questionnaire) by specifying
order_with_respect_to
in a model'sMeta
class: https://docs.djangoproject.com/en/5.0/ref/models/options/#order-with-respect-toDoing so generates four new methods in total:
get_next_in_order
get_previous_in_order
get_RELATED_order
(whereRELATED
is the name of the first model)set_RELATED_order
However, these methods are not recognized by django-stubs, I get an error as if I had a typo. Making the
Meta
class inherit fromTypedModelMeta
has no effect.How is that should be
These four methods should be recognized, along with the correct type for the primary key. This means the
get
method returns aQuerySet
of whatever type the PK is, and theset
method takes anIterable
of whatever the type of the PK is. Thenext
andprevious
methods return an instance of whatever their model is. They do loop around, so there will always be an object.System information
python
version: 3.12.2django
version: 5.0.3mypy
version: 1.9.0django-stubs
version: 4.2.7django-stubs-ext
version: 4.2.7The text was updated successfully, but these errors were encountered: