Skip to content

LagLeadFunction: type of default parameter #2807

@H4rryK4ne

Description

@H4rryK4ne

Bug report

What's wrong

It seams suspicious to me, that the default parameter of django.db.models.functions.window.LagLeadFunction (django-stubs/db/models/functions/window.pyi:15) shall be an int.

The documentation says:

Lag

class Lag(expression, offset=1, default=None, **extra)

Calculates the value offset by offset, and if no row exists there, returns default.

default must have the same type as the expression, however, this is only validated by the database and not in Python.

How is that should be

I would expect something like Expression, maybe ...

System information

  • OS: Linux
  • python version: 3.13.7
  • django version: 5.2.5
  • mypy version: 1.17.1
  • django-stubs version: 5.2.2
  • django-stubs-ext version: 5.2.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions