File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -436,23 +436,24 @@ def project_field(column):
436
436
@cached_property
437
437
def base_table (self ):
438
438
return next (
439
- v
440
- for k , v in self .query .alias_map .items ()
441
- if isinstance (v , BaseTable ) and self .query .alias_refcount [k ]
439
+ (
440
+ v
441
+ for k , v in self .query .alias_map .items ()
442
+ if isinstance (v , BaseTable ) and self .query .alias_refcount [k ]
443
+ ),
444
+ None ,
442
445
)
443
446
444
447
@cached_property
445
448
def collection_name (self ):
446
- try :
447
- base_table = self .base_table
448
- except StopIteration :
449
- # Use a dummy collection if the query doesn't specify a table
450
- # (such as Constraint.validate() with a condition).
451
- query = self .query_class (self )
452
- query .aggregation_pipeline = [{"$facet" : {"__null" : []}}]
453
- self .subqueries .insert (0 , query )
454
- return "__null"
455
- return base_table .table_alias or base_table .table_name
449
+ if self .base_table :
450
+ return self .base_table .table_alias or self .base_table .table_name
451
+ # Use a dummy collection if the query doesn't specify a table
452
+ # (such as Constraint.validate() with a condition).
453
+ query = self .query_class (self )
454
+ query .aggregation_pipeline = [{"$facet" : {"__null" : []}}]
455
+ self .subqueries .insert (0 , query )
456
+ return "__null"
456
457
457
458
@cached_property
458
459
def collection (self ):
You can’t perform that action at this time.
0 commit comments