#28492 closed Cleanup/optimization (fixed)
Allow defining expressions' default output_field as a class attribute rather than in __init__()
Reported by: | Mads Jensen | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Simon Charette | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
There are a few expression-classes that override __init__
just to set output_field
,
class Extent3D(GeoAggregate): def __init__(self, expression, **extra): super().__init__(expression, output_field=ExtentField(), **extra)
From this comment https://github.com/django/django/pull/7611/files#r131567089 runtests.py
needs to be adjusted, so it's possible to use a class-variable for the output field instead.
Change History (5)
comment:1 by , 7 years ago
Cc: | added |
---|---|
Has patch: | set |
Patch needs improvement: | set |
Summary: | output_field in __init__-method of expressions → Allow defining expressions' default output_field as a class attribute rather than in __init__() |
Triage Stage: | Unreviewed → Accepted |
Note:
See TracTickets
for help on using tickets.
Simon has a PR for this.