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 GroupPresetExport(BaseModel): | |
""" | |
Grupo presets para exportação. | |
O User deverá selecionar as questões à serem exportadas e essa | |
filtragem deverá ser salva para que ele possa aplicá-la sem ter | |
de refazê-las. | |
""" | |
user = models.ForeignKey('user.User') | |
keys = models.TextField(verbose_name=_("Questions to be exported")) |
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 django.core.exceptions import PermissionDenied | |
from django.shortcuts import get_object_or_404 | |
from form.models import Form | |
def user_permission_required(codename, form_pk_param="pk"): | |
def decorate(view): | |
def decorated(request, *args, **kwargs): | |
form = get_object_or_404(Form, pk=kwargs[form_pk_param]) |
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 django.contrib.auth.models import User | |
def permissoes_decorator(f): | |
def verifica(request, *args, **kwargs): | |
pode_add = request.user.has_perm('rh.add_cadastro') | |
import pdb; pdb.set_trace() | |
if pode_add: |
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
$.ajax({ | |
type:"GET", | |
data: {"id_cpf" : $('#id_cpf').val()}, | |
url:"/user/validate/", | |
success:function(data){ | |
if (data == "True") { | |
$('#id_cpf').css( | |
{color: '#5BC24C', 'font-weight' : 'bold'} | |
); |
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
$.ajax({ | |
type:"GET", | |
data: {"id_cpf" : $('#id_cpf').val()}, | |
url:"/user/validate/", | |
success:function(data){ | |
switch (data) { | |
case "True": | |
$('#id_cpf').css( | |
{color: '#5BC24C', 'font-weight' : 'bold'} |
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
$.ajax({ | |
type:"GET", | |
data: {"id_cpf" : $('#id_cpf').val()}, | |
url:"/user/validate/", | |
success:function(data){ | |
switch (data) { | |
case "True": | |
$('#id_cpf').css( | |
{color: '#5BC24C', 'font-weight' : 'bold'} |
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 django.core.management.base import BaseCommand | |
from billing.tasks import check_balance_and_warn | |
class Command(BaseCommand): | |
help = "Check client's balance and send warnings to them" | |
def handle(self, *args, **options): | |
check_balance_and_warn() |
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
var marker1 = new google.maps.Marker({ | |
position: myLatLng, | |
map: map, | |
icon: { | |
url: image, | |
size: new google.maps.Size(134,130), //different sizes | |
}, | |
zIndex: 2, //different overlays | |
title: '1º marker', | |
}); |
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
@login_required | |
def form_csv(request, pk): | |
queue = django_rq.get_queue() | |
form = get_object_or_404(Form, pk=pk) | |
export = form.export_set.create(request_user=request.user) | |
export.start = datetime.now() | |
export.option_key = request.POST.get('option_key', 'label') | |
export.save(update_fields=['start']) | |
queue.enqueue(as_xls, export, timeout=700) |
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
@login_required | |
def form_csv(request, pk): | |
queue = django_rq.get_queue() | |
form = get_object_or_404(Form, pk=pk) | |
export = form.export_set.create(request_user=request.user) | |
export.start = datetime.now() | |
export.option_key = request.POST.get('option_key', 'label') | |
export.save(update_fields=['start']) | |
queue.enqueue(as_xls, export, timeout=700) |