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
# An very simple example of CRUD using Django + Django Rest Framework | |
# models.py file | |
from django.db import models | |
from django.contrib.auth.models import User | |
class Position(models.Model): | |
latitude = models.TextField() | |
longitude = models.TextField() | |
user = models.ForeingKey(User) |
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 datetime | |
keys = ['id', 'usuario_id', 'operador_id', 'nome', 'descricao', 'imagem_documento', 'orgao', 'data_criacao', 'data_emissao', 'data_validade', 'validado', 'notificacao', 'dias_aviso'] | |
tupla_exemplo = (40, None, 45, 'MTR', 'Trecho de c\xc3\xb3digo retirado da aplica\xc3\xa7\xc3\xa3o Source Tree.', 'MTR1458151222193', 'Minist\xc3\xa9rio do Meio Ambiente', datetime.datetime(2016, 3, 16, 15, 0, 22), datetime.datetime(2016, 3, 14, 15, 0, 22), datetime.datetime(2016, 3, 23, 15, 0, 22), None, True, 5) | |
lista_fake_do_banco = [tupla_exemplo, tupla_exemplo, tupla_exemplo] | |
lista_desejada = [] |
Previous versions used homebrew to install the various versions. As suggested in the comments, it's better to use pyenv
instead. If you are looking for the previous version of this document, see the revision history.
$ brew update
$ brew install pyenv
$ pyenv install 3.5.0
$ pyenv install 3.4.3
$ pyenv install 3.3.6
$ pyenv install 3.2.6
$ pyenv install 2.7.10
$ pyenv install 2.6.9
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
// Não vamos colocar meta. Vamos deixar a meta aberta e quando atingirmos a meta, vamos dobrar a meta. | |
function metaCtrl($scope) { | |
$scope.$watch( | |
function($scope) { | |
return $scope.meta; | |
}, | |
function() { | |
if ($scope.meta) { | |
$scope.meta *= 2; | |
} |