Skip to content

Instantly share code, notes, and snippets.

View pliniomikael's full-sized avatar
🏠
Working from home

Plinio Mikael pliniomikael

🏠
Working from home
View GitHub Profile
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
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:
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)
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}
@pliniomikael
pliniomikael / todo.py
Created July 27, 2020 13:36
form upload
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"
{
"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
@pliniomikael
pliniomikael / anotacoes-docker.md
Last active April 27, 2021 02:22 — forked from leohmoraes/anotacoes-docker.md
##Rocketseat - Modulo 2 - Video 4:Docker - Anotacoes do Curso Rocketseat

Docker

Rocketseat - Modulo 2 - Video 3:Docker

No Docker

- Postgress
- MySql
- MongoDB
- Node ?
- Python ?