Deployed c8b6d3d with MkDocs version: 1.6.0

This commit is contained in:
2025-08-12 14:21:19 +00:00
parent 9452cacb6d
commit a71f564666
3 changed files with 10 additions and 4 deletions

View File

@ -895,13 +895,15 @@ explicitly declare the <code>BooleanField</code> on the serializer class, or use
<h2 id="durationfield"><a class="toclink" href="#durationfield">DurationField</a></h2>
<p>A Duration representation.
Corresponds to <code>django.db.models.fields.DurationField</code></p>
<p>The <code>validated_data</code> for these fields will contain a <code>datetime.timedelta</code> instance.
The representation is a string following this format <code>'[DD] [HH:[MM:]]ss[.uuuuuu]'</code>.</p>
<p><strong>Signature:</strong> <code>DurationField(max_value=None, min_value=None)</code></p>
<p>The <code>validated_data</code> for these fields will contain a <code>datetime.timedelta</code> instance.</p>
<p><strong>Signature:</strong> <code>DurationField(format=api_settings.DURATION_FORMAT, max_value=None, min_value=None)</code></p>
<ul>
<li><code>format</code> - A string representing the output format. If not specified, this defaults to the same value as the <code>DURATION_FORMAT</code> settings key, which will be <code>'django'</code> unless set. Formats are described below. Setting this value to <code>None</code> indicates that Python <code>timedelta</code> objects should be returned by <code>to_representation</code>. In this case the date encoding will be determined by the renderer.</li>
<li><code>max_value</code> Validate that the duration provided is no greater than this value.</li>
<li><code>min_value</code> Validate that the duration provided is no less than this value.</li>
</ul>
<h4 id="durationfield-formats"><a class="toclink" href="#durationfield-formats"><code>DurationField</code> formats</a></h4>
<p>Format may either be the special string <code>'iso-8601'</code>, which indicates that <a href="https://www.w3.org/TR/NOTE-datetime">ISO 8601</a> style intervals should be used (eg <code>'P4DT1H15M20S'</code>), or <code>'django'</code> which indicates that Django interval format <code>'[DD] [HH:[MM:]]ss[.uuuuuu]'</code> should be used (eg: <code>'4 1:15:20'</code>).</p>
<hr />
<h1 id="choice-selection-fields"><a class="toclink" href="#choice-selection-fields">Choice selection fields</a></h1>
<h2 id="choicefield"><a class="toclink" href="#choicefield">ChoiceField</a></h2>

View File

@ -683,6 +683,10 @@ internally in the codebase.</p>
<p>A list of format strings that should be used by default for parsing inputs to <code>TimeField</code> serializer fields.</p>
<p>May be a list including the string <code>'iso-8601'</code> or Python <a href="https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes">strftime format</a> strings.</p>
<p>Default: <code>['iso-8601']</code></p>
<h4 id="duration_format"><a class="toclink" href="#duration_format">DURATION_FORMAT</a></h4>
<p>Indicates the default format that should be used for rendering the output of <code>DurationField</code> serializer fields. If <code>None</code>, then <code>DurationField</code> serializer fields will return Python <code>timedelta</code> objects, and the duration encoding will be determined by the renderer.</p>
<p>May be any of <code>None</code>, <code>'iso-8601'</code> or <code>'django'</code> (the format accepted by <code>django.utils.dateparse.parse_duration</code>).</p>
<p>Default: <code>'django'</code></p>
<hr />
<h2 id="encodings"><a class="toclink" href="#encodings">Encodings</a></h2>
<h4 id="unicode_json"><a class="toclink" href="#unicode_json">UNICODE_JSON</a></h4>

File diff suppressed because one or more lines are too long