- Postgress
- MySql
- MongoDB
- Node ?
- Python ?
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
Creating test database for alias 'default'... | |
/home/.virtualenvs/semana/lib/python3.8/site-packages/django/db/backends/postgresql/base.py:294: RuntimeWarning: Normally Django will use a connection to the 'postgres' database to avoid running initialization queries against the production database when it's not needed (for example, when running tests). Django was unable to create a connection to the 'postgres' database and will use the first PostgreSQL database instead. | |
warnings.warn( | |
Got an error creating the test database: permission denied to create database |
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
if request.method == "POST": | |
username = request.POST.get("username") | |
password = request.POST.get("password") | |
user = authenticate(request, username=username, password=password) | |
if user is not None: | |
if user.is_active: | |
print("User is valid, active and authenticated") | |
login(request, user) | |
return redirect("painel") | |
else: |
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
form_arquivo = ArquivoModelForm(request.POST) | |
form_upload = UploadArquivoForms(request.POST, request.FILES) | |
if form_arquivo.is_valid(): | |
ark = form_arquivo.save(commit=False) | |
ark.usuario = empresa | |
ark.categoria = cat | |
ark.save() | |
for field in request.FILES.keys(): | |
for formfile in request.FILES.getlist(field): | |
file = UploadArquivo(upload=formfile, arquivo=ark) |
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
def empresapage(request, pk): | |
empresa = User.objects.get(id=pk) | |
arquivos = empresa.arquivo_set.filter( | |
Q(categoria="CONTABIL") | |
| Q(categoria="PESSOAL") | |
| Q(categoria="FISCAL") | |
| Q(categoria="EXTRAS"), | |
) | |
context = {"empresa": empresa, "arquivos": arquivos} |
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
html | |
<form | |
method="POST" | |
enctype="multipart/form-data" | |
> | |
{% csrf_token %} | |
{{form_servidor.arquivo}} | |
{{form_servidor.descricao}} | |
<button | |
class="col-5 btn btn-primary mr-2" |
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
import requests | |
import io | |
import os | |
import sys | |
from pytube import YouTube | |
from youtube_transcript_api import YouTubeTranscriptApi | |
from isodate import parse_duration |
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
{ | |
"workbench.colorTheme": "Shades of Purple", | |
// Define o tema do VSCode | |
// Configura tamanho e família da fonte | |
"editor.fontSize": 14, | |
"editor.lineHeight": 24, | |
"editor.fontFamily": "Fira Code", | |
"editor.fontLigatures": true, | |
"explorer.compactFolders": false, | |
// Aplica linhas verticais para lembrar de quebrar linha em códigos muito grandes |