Django manages media based on the following definitions:
BASE_DIR = /var/praekelt/telkom-spliceworks/
MEDIA_ROOT = "%s/media/" % BASE_DIR
import { defineStore } from 'pinia' | |
/* store/auth.js */ | |
export const useAuthStore = defineStore('auth', { | |
state: () => ({ | |
token: '' | |
}), | |
getters: { |
# dependencies ImageMagick | |
# reduce files > 1024MB | |
import os | |
from pathlib import Path | |
import subprocess | |
import time | |
for c in CadImages.objects.filter(somefilter='lslslsl'): | |
ext = c.my_image_field.path.split('/')[-1].split('.')[-1] | |
if ext.lower() == 'pdf': | |
# exclude PDF |
# Using django import_export with transactions | |
# the whole was about 40 minutes before change, now 5 minutes. | |
from import_export.utils import atomic_if_using_transaction | |
from django.db import connections, DEFAULT_DB_ALIAS | |
from django.core.exceptions import ImproperlyConfigured | |
class PubliResource(resources.ModelResource): | |
use_transactions_in_dry_run = False # <===== |
from django.contrib import admin | |
from .models import Cliente, Funcionario | |
admin.site.register(Cliente) | |
admin.site.register(Funcionario) | |
# Tabela domain | |
MariaDB [opensips]> desc domain; | |
+---------------+------------------+------+-----+---------------------+----------------+ | |
| Field | Type | Null | Key | Default | Extra | | |
+---------------+------------------+------+-----+---------------------+----------------+ | |
| id | int(10) unsigned | NO | PRI | NULL | auto_increment | | |
| domain | char(64) | NO | UNI | | | | |
| attrs | char(255) | YES | | NULL | | | |
| created_at | datetime | YES | | NULL | | | |
| last_modified | datetime | NO | | 1900-01-01 00:00:01 | | |
#!/bin/sh | |
#remove migrations files | |
find .. -path "*/migrations/*.py" -not -name "__init__.py" -delete | |
find .. -path "*/migrations/*.pyc" -delete | |
#delete records from migrations table | |
psql -d <nome_projeto> -c 'delete from django_migrations;' | |
#create migrations again |
import platform | |
import requests | |
from time import sleep | |
import os | |
import sys | |
from contextlib import contextmanager | |
from os import mkdir, getcwd | |
from selenium import webdriver | |
from PIL import Image | |
from selenium.webdriver.chrome.options import Options |
from django.http import HttpResponse, HttpResponseRedirect | |
from django.contrib.auth import authenticate, login | |
def login(request): | |
if request.POST: | |
username = request.POST['username'] | |
password = request.POST['password'] | |
user = authenticate(username=username, password=password) | |
if user is not None: |
<template> | |
<q-page> | |
<q-input | |
float-label="CNPJ/CPF BR" | |
v-mask="['###.###.###-##', '##.###.###/####-##']" | |
placeholder="only numbers" | |
v-model="form.cpfCnpj" | |
</q-input> | |
</q-page> | |
</template> |