This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| Altera datas após executar o seed. | |
| pip install faker | |
| ''' | |
| from datetime import date, timedelta | |
| from faker import Faker | |
| from random import randint | |
Dica: bugfix quem estiver mexendo com upload múltiplo vai se deparar com este erro:
ValueError: ClearableFileInput doesn't support uploading multiple files.
Para corrigir faça em forms.py
from django import forms
<script
src="{% static 'js/main.js' %}"
data-csrf="{{ csrf_token }}"
></script>vitalik/django-ninja#444 (comment)
Para salvar FK automaticamente no django-ninja renomeie o field para field_id no back e no front.
O que você quer é um relacionamento reverso.
No Postman você precisa inserir os dados da seguinte forma:
endpoint: http://localhost:8000/api/v1/series/
{
"titulo": "The Hundred",
"temporadas": [
pip install xhtml2pdf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| indenter: | |
| find backend -name "*.html" | xargs djhtml -t 2 | |
| autopep8: | |
| find backend -name "*.py" | xargs autopep8 --max-line-length 120 --in-place | |
| isort: | |
| isort -m 3 * --skip migrations --skip .venv | |
| lint: autopep8 isort indenter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function group_by_date(transactions) { | |
| /* | |
| Agrupa os dados por data. | |
| */ | |
| // Dicionário vazio | |
| const result = {} | |
| for (const transaction of transactions) { | |
| // Adiciona uma chave no dicionário | |
| const date = transaction['date'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Run this code with manager.py folder. | |
| # Usage: $ ~/.dj_scaffold.sh crm person | |
| <<comment | |
| Create templates | |
| * _list.html | |
| * _detail.html |