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
parent = get_object_or_404(queryset, id=int(parent_id), user=rootuser) | |
data = Question.objects.filter(parent=parent, deleted=False) | |
serializer = QuestionListSerializer(data) | |
serializer.data | |
erro: | |
IndexError Traceback (most recent call last) |
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 isinstance(dados, dict): | |
Passagens126.objects.create(**to_kwargs(dados)) | |
else: | |
for item in dados: | |
print(item) | |
Passagens126.objects.create(**to_kwargs(item)) | |
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 $input = $('#id_cpf'); | |
$input[0].sent = false; | |
$input.keyup(function () { | |
var value = $(this).val(); | |
if (value.length === 11 && !this.sent){ | |
this.sent = true; | |
$.ajax({ /* ajax goes here */ }); |
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
value = { 'a': | |
{ | |
'c': 1, | |
'd': [ | |
{ 'a': 1 } | |
] | |
} | |
} |
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.db import models | |
import json | |
class JSONField(models.TextField): | |
def __init__(self, verbose_name=None, name=None, default=None, **kwargs): | |
models.TextField.__init__(self, verbose_name, name, **kwargs) | |
def to_python(self, value): | |
if isinstance(value, six.string_types) or value is None: | |
return value |
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 django.conf.urls import patterns, url, include | |
from rest_framework import routers | |
from .views import (ClientPlanViewSet, PlanViewSet, | |
ClientPlanReportViewSet, ReportUsage) | |
router = routers.DefaultRouter() | |
router.register(r'billing/manage', ClientPlanViewSet, | |
base_name='billing_manage') |
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
moment.locale('pt-BR'); | |
$scope.months = []; | |
$scope.series = []; | |
$scope.data = []; | |
$http.get('/nodes') | |
.then(function(response) { | |
var months = {}; | |
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
$scope.questionnaires = []; | |
$scope.selectAll = function() { | |
$scope.selected = $scope.questionnaires.map(function(q) { | |
return q.id; | |
}); | |
}; | |
$scope.clear = function() { | |
$scope.selected = []; |
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
app.factory('Client', function() { | |
function Client(obj) { | |
obj.created = new Date(obj.created); | |
angular.extend(this, obj); | |
} | |
return Client; | |
}); |
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
def do_update(self, obj, request): | |
obj.user = request.user.get_root() | |
serializer = DeviceSerializer(obj, data=request.data, partial=True) | |
is_create = obj.pk is None | |
if serializer.is_valid(): | |
serializer.save() | |
if is_create: |
NewerOlder