Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7k
Commitdba9493
authored
Don't evaluate default_timezone unless needed (#8531)
If you set a custom timezone for a DateTimeField, the functionself.default_timezone() is still called, since fallback params togetattr are still evaluated.This rewrites to use hasattr, so the fallback case is only executed ifit will actually be used. If you render a lot of DateTimeFields in aserializer, the time spent evaluating default_timezone() once for eachof them can accumulate to quite a bit, which is just unused work in thecase where timezone is already specified on the field.1 parentfa9d516 commitdba9493
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1179 | 1179 | | |
1180 | 1180 | | |
1181 | 1181 | | |
1182 | | - | |
| 1182 | + | |
1183 | 1183 | | |
1184 | 1184 | | |
1185 | 1185 | | |
| |||
0 commit comments
Comments
(0)