Skip to content

Instantly share code, notes, and snippets.

André Duarte clint74

Block or report user

Report or block clint74

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
# 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
View gist:2982dbda31d0a302581b4d83f21a6740
# 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 | |
#remove migrations files
find .. -path "*/migrations/*.py" -not -name "" -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 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:
View quasar-vue-mask.vue
float-label="CNPJ/CPF BR"
v-mask="['###.###.###-##', '##.###.###/####-##']"
placeholder="only numbers"
clint74 /
Created Aug 29, 2018
Run cron task in your Django environment
import os
import sys
DEBUG = False
#DEBUG = True
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
View scripts.html
{% load staticfiles %}
<script type="text/javascript" src="{% static 'js/jquery-3.3.1.slim.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/popper.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/bootstrap.min.js' %}"></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>
from django import forms
from advertisement.models import Advertisement, Category
class AdvertisementForm(forms.ModelForm):
class Meta:
model = Advertisement
fields = [
You can’t perform that action at this time.