Skip to content
This repository has been archived by the owner on Jul 30, 2023. It is now read-only.

Commit

Permalink
mkdocs: enable Table of Contents extension and hide edit button
Browse files Browse the repository at this point in the history
  • Loading branch information
xshapira committed Nov 6, 2022
1 parent 539867b commit 4fadc3c
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 50 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ repos:
hooks:
# - id: check-added-large-files
- id: check-toml
- id: check-yaml
args:
- --unsafe
# - id: check-yamlr
# args:
# - --unsafe
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
Expand Down
3 changes: 3 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ site_url: https://dantico.github.io/

repo_name: xshapira/dantico
repo_url: https://github.com/xshapira/dantico
edit_uri: ''

theme:
name: 'material'
Expand Down Expand Up @@ -35,6 +36,8 @@ markdown_extensions:
- tables
- pymdownx.highlight
- pymdownx.superfences
- toc:
permalink: True

nav:
- 'Quick start': index.md
Expand Down
7 changes: 1 addition & 6 deletions site/excluding_including/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,8 @@



<a href="https://github.com/xshapira/dantico/edit/master/docs/excluding_including.md" title="Edit this page" class="md-content__button md-icon">

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25Z"/></svg>
</a>


<h1 id="excluding-and-including-model-fields">Excluding and including model fields</h1>
<h1 id="excluding-and-including-model-fields">Excluding and including model fields<a class="headerlink" href="#excluding-and-including-model-fields" title="Permanent link">&para;</a></h1>
<p>By default <em>dantico</em> include all the fields from the Django model. As a rule of thumb, always use the <code>include</code> or <code>exclude</code> attribute to explicitly define a list of fields that you want to be visible in your API. <strong>Note that you cannot use both at the same time</strong>.</p>
<div class="highlight"><pre><span></span><code><span class="c1"># schemas.py</span>

Expand Down
7 changes: 1 addition & 6 deletions site/field_validator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,8 @@



<a href="https://github.com/xshapira/dantico/edit/master/docs/field_validator.md" title="Edit this page" class="md-content__button md-icon">

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25Z"/></svg>
</a>


<h1 id="field-validator">Field validator</h1>
<h1 id="field-validator">Field validator<a class="headerlink" href="#field-validator" title="Permanent link">&para;</a></h1>
<p>Custom validation is not an easy task in this case. But we still can achieve it by using threads.</p>
<p>Because we define a validator to validate fields on inheriting models, we should set <code>check_fields=False</code> on the validator. More information can be found <a href="https://pydantic-docs.helpmanual.io/usage/validators/">here</a>.</p>
<div class="highlight"><pre><span></span><code><span class="c1"># schemas.py</span>
Expand Down
15 changes: 5 additions & 10 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,8 @@



<a href="https://github.com/xshapira/dantico/edit/master/docs/index.md" title="Edit this page" class="md-content__button md-icon">

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25Z"/></svg>
</a>


<h1 id="dantico">dantico</h1>
<h1 id="dantico">dantico<a class="headerlink" href="#dantico" title="Permanent link">&para;</a></h1>
<p>Tools to convert Django ORM models to Pydantic models.</p>
<p><a href="https://github.com/xshapira/dantico"><img alt="GitHub Actions (Test)" src="https://github.com/xshapira/dantico/workflows/Test/badge.svg" /></a>
<a href="https://codecov.io/gh/xshapira/dantico"><img alt="Codecov" src="https://img.shields.io/codecov/c/gh/xshapira/dantico?color=%2334D058" /></a>
Expand All @@ -470,16 +465,16 @@ <h1 id="dantico">dantico</h1>
<p><strong>Field Validator</strong>: Fields can be validated with Pydantic <strong><a href="https://pydantic-docs.helpmanual.io/usage/validators/">validator</a></strong> or <strong><a href="https://pydantic-docs.helpmanual.io/usage/validators/">root_validator</a></strong>.</p>
</li>
</ul>
<h2 id="requirements">Requirements</h2>
<h2 id="requirements">Requirements<a class="headerlink" href="#requirements" title="Permanent link">&para;</a></h2>
<ul>
<li>Python 3.7+</li>
<li>Django 3.0+</li>
<li>Pydantic 1.6+</li>
</ul>
<h2 id="installation">Installation</h2>
<h2 id="installation">Installation<a class="headerlink" href="#installation" title="Permanent link">&para;</a></h2>
<div class="highlight"><pre><span></span><code>pip install dantico
</code></pre></div>
<h2 id="usage">Usage</h2>
<h2 id="usage">Usage<a class="headerlink" href="#usage" title="Permanent link">&para;</a></h2>
<p>Assume we have the following user model definition:</p>
<div class="highlight"><pre><span></span><code><span class="c1"># models.py</span>

Expand Down Expand Up @@ -595,7 +590,7 @@ <h2 id="usage">Usage</h2>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<h2 id="license">License</h2>
<h2 id="license">License<a class="headerlink" href="#license" title="Permanent link">&para;</a></h2>
<p>This project is licensed under the terms of the MIT license.</p>


Expand Down
7 changes: 1 addition & 6 deletions site/introspect/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,8 @@



<a href="https://github.com/xshapira/dantico/edit/master/docs/introspect.md" title="Edit this page" class="md-content__button md-icon">

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25Z"/></svg>
</a>


<h1 id="introspect-the-related-objects">Introspect the related objects</h1>
<h1 id="introspect-the-related-objects">Introspect the related objects<a class="headerlink" href="#introspect-the-related-objects" title="Permanent link">&para;</a></h1>
<p>The <code>depth</code> attribute lets us look into the Django model relations (many to one, one to one, many to many).</p>
<p>Consider the following models definitions:</p>
<div class="highlight"><pre><span></span><code><span class="c1"># models.py</span>
Expand Down
7 changes: 1 addition & 6 deletions site/optional_fields/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,8 @@



<a href="https://github.com/xshapira/dantico/edit/master/docs/optional_fields.md" title="Edit this page" class="md-content__button md-icon">

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25Z"/></svg>
</a>


<h1 id="optional-model-fields">Optional model fields</h1>
<h1 id="optional-model-fields">Optional model fields<a class="headerlink" href="#optional-model-fields" title="Permanent link">&para;</a></h1>
<p>We can also specify model fields to mark as <code>optional</code>.</p>
<div class="highlight"><pre><span></span><code><span class="c1"># schemas.py</span>

Expand Down
7 changes: 1 addition & 6 deletions site/schema_customization/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,8 @@



<a href="https://github.com/xshapira/dantico/edit/master/docs/schema_customization.md" title="Edit this page" class="md-content__button md-icon">

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25Z"/></svg>
</a>


<h1 id="schema-customization">Schema customization</h1>
<h1 id="schema-customization">Schema customization<a class="headerlink" href="#schema-customization" title="Permanent link">&para;</a></h1>
<p>Docstrings and titles can be used as descriptive text in the schema output.</p>
<div class="highlight"><pre><span></span><code><span class="c1"># schemas.py</span>

Expand Down
2 changes: 1 addition & 1 deletion site/search/search_index.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions site/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://dantico.github.io/</loc>
<lastmod>2022-10-29</lastmod>
<lastmod>2022-11-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://dantico.github.io/excluding_including/</loc>
<lastmod>2022-10-29</lastmod>
<lastmod>2022-11-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://dantico.github.io/field_validator/</loc>
<lastmod>2022-10-29</lastmod>
<lastmod>2022-11-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://dantico.github.io/introspect/</loc>
<lastmod>2022-10-29</lastmod>
<lastmod>2022-11-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://dantico.github.io/optional_fields/</loc>
<lastmod>2022-10-29</lastmod>
<lastmod>2022-11-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://dantico.github.io/schema_customization/</loc>
<lastmod>2022-10-29</lastmod>
<lastmod>2022-11-06</lastmod>
<changefreq>daily</changefreq>
</url>
</urlset>
Binary file modified site/sitemap.xml.gz
Binary file not shown.

0 comments on commit 4fadc3c

Please sign in to comment.