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
file = request.FILES['file'] | |
dialect = csv_mod.Sniffer().sniff(codecs.EncodedFile(file,"utf-8").read(1024)) | |
file.open() | |
csv = csv_mod.DictReader( codecs.EncodedFile(file,"utf-8"), dialect=dialect ) |
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
Vá no diretório que deseja criar o ambiente virtual | |
cd C:\virtual | |
Crie um ambiente virtual | |
virtualenv --no-site-packages nomedoambiente | |
Ativar o ambiente virtual | |
cd C:\virtual\ambiente1.3\Scripts | |
Comando para ativar o ambiente virtual |
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 encoding != "utf-8": |
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
/* >>>>>>>>>>>>>>> models.py <<<<<<<<<<<<< */ | |
from django.db import models | |
class MeuModelo(models.Model): | |
estado = models.ForeignKey('Estado') | |
cidade = models.ForeignKey('Cidade') | |
class Pais(models.Model): |
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
<a href="{{ request.META.HTTP_REFERER }}"> Voltar </a> |
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 os | |
import sys | |
import site | |
# Calculates the path based on location of WSGI script. | |
apache_configuration = os.path.realpath(os.path.dirname(__file__)) | |
project = os.path.join(apache_configuration, 'nomedoproto') | |
sys.path.append(apache_configuration) | |
sys.path.append(project) |
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
from datetime import * | |
hoje = date.today() | |
data_limite = hoje + timedelta(days=60) | |
print hoje | |
print data_limite |
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
# -*- coding: utf-8 -*- | |
from datetime import datetime | |
from django.contrib.auth.models import User | |
from django.db import models | |
from geral.models import Pessoas, BasePessoas, Unidades, Orgaos, Logradouros | |
OPERACAO = (('1', 'Despacho'),('2', 'Transferência'),('3', 'Parecer')) | |
SETOR_CHOICES = (('P', 'Processo'),('O', 'ouvidoria')) | |
class Advogados(BasePessoas, Logradouros): | |
oab = models.CharField('OAB', max_length=10, blank=True, null=True) |
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 method="POST"> | |
{% csrf_token %} | |
<p><label>Deseja se identificar?</label>{{ form.anonimo }}</p> | |
<div class="control-group"> | |
<p><label>Nome</label>{{ formP.nome }}</p> | |
<p><label>CPF</label>{{ formP.cpf }}</p> | |
<p><label>RG</label>{{ formP.rg }}</p> | |
<p><label>Telefone</label>{{ formP.telefone }}</p> | |
</div> | |
<p><label>Qual é o tipo da sua manifestação?</label>{{ form.objeto }}</p> |
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
class ManifestacoesForm(forms.ModelForm): | |
class Meta: | |
model = Manifestacoes | |
exclude = ['codigo', 'ano', 'transferido', 'arquivado', 'ala', 'estante', 'prateleira', 'caixa', 'cancelamento', 'motivo_cancelamento'] | |
def __init__(self, *args, **kwargs): | |
super(ManifestacoesForm, self).__init__(*args, **kwargs) | |
self.fields.keyOrder = ['name', 'summary', 'description'] |