﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29172	Using Window in Subquery causes AttributeError	Tomáš Ehrlich	nobody	"Using Window expression within Subquery causes an `AttributeError:  'NoneType' object has no attribute ‘relabeled_clone'`

Error is raised in `relabeled_clone` method,
https://github.com/django/django/blob/master/django/db/models/expressions.py#L319
which calls `e.relabeled_clone` method on every expression returned from `get_source_expressions`.

Window expression returns `source_expression`, `partition_by`, `order_by` and `frame` in `get_source_expression`:
https://github.com/django/django/blob/master/django/db/models/expressions.py#L1188
but all parameters except `source_expression` are optional and might be `None`. This leads to AttributeError."	Bug	closed	Database layer (models, ORM)	2.0	Normal	fixed	subquery window expression orm		Ready for checkin	1	0	0	0	0	0
