mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 01:47:59 +03:00 
			
		
		
		
	Document DateTimeField default_timezone argument (#6469)
This commit is contained in:
		
							parent
							
								
									6f24c21cfb
								
							
						
					
					
						commit
						d2d1888217
					
				| 
						 | 
					@ -306,10 +306,11 @@ A date and time representation.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Corresponds to `django.db.models.fields.DateTimeField`.
 | 
					Corresponds to `django.db.models.fields.DateTimeField`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Signature:** `DateTimeField(format=api_settings.DATETIME_FORMAT, input_formats=None)`
 | 
					**Signature:** `DateTimeField(format=api_settings.DATETIME_FORMAT, input_formats=None, default_timezone=None)`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* `format` - A string representing the output format. If not specified, this defaults to the same value as the `DATETIME_FORMAT` settings key, which will be `'iso-8601'` unless set. Setting to a format string indicates that `to_representation` return values should be coerced to string output. Format strings are described below. Setting this value to `None` indicates that Python `datetime` objects should be returned by `to_representation`. In this case the datetime encoding will be determined by the renderer.
 | 
					* `format` - A string representing the output format. If not specified, this defaults to the same value as the `DATETIME_FORMAT` settings key, which will be `'iso-8601'` unless set. Setting to a format string indicates that `to_representation` return values should be coerced to string output. Format strings are described below. Setting this value to `None` indicates that Python `datetime` objects should be returned by `to_representation`. In this case the datetime encoding will be determined by the renderer.
 | 
				
			||||||
* `input_formats` - A list of strings representing the input formats which may be used to parse the date.  If not specified, the `DATETIME_INPUT_FORMATS` setting will be used, which defaults to `['iso-8601']`.
 | 
					* `input_formats` - A list of strings representing the input formats which may be used to parse the date.  If not specified, the `DATETIME_INPUT_FORMATS` setting will be used, which defaults to `['iso-8601']`.
 | 
				
			||||||
 | 
					* `default_timezone` - A `pytz.timezone` representing the timezone. If not specified and the `USE_TZ` setting is enabled, this defaults to the [current timezone][django-current-timezone]. If `USE_TZ` is disabled, then datetime objects will be naive.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### `DateTimeField` format strings.
 | 
					#### `DateTimeField` format strings.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -835,3 +836,4 @@ The [django-rest-framework-hstore][django-rest-framework-hstore] package provide
 | 
				
			||||||
[django-rest-framework-hstore]: https://github.com/djangonauts/django-rest-framework-hstore
 | 
					[django-rest-framework-hstore]: https://github.com/djangonauts/django-rest-framework-hstore
 | 
				
			||||||
[django-hstore]: https://github.com/djangonauts/django-hstore
 | 
					[django-hstore]: https://github.com/djangonauts/django-hstore
 | 
				
			||||||
[python-decimal-rounding-modes]: https://docs.python.org/3/library/decimal.html#rounding-modes
 | 
					[python-decimal-rounding-modes]: https://docs.python.org/3/library/decimal.html#rounding-modes
 | 
				
			||||||
 | 
					[django-current-timezone]: https://docs.djangoproject.com/en/stable/topics/i18n/timezones/#default-time-zone-and-current-time-zone
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user