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
[ | |
{ | |
"code":12, | |
"initials":"AC", | |
"name":"Acre", | |
"cities":[ | |
{ | |
"code":1200013, | |
"name":"ACRELANDIA" | |
}, |
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 .models import YourModel | |
from .serializers import YourModelSerialize | |
from .viewsets import CRUDViewSet | |
# As good practice, create your viewset using the Resource as Prefix: YourModel | |
class YourModelViewSet(CRUDViewSet): | |
queryset = Invoice.objects.all() | |
serializer_class = InvoiceSerializer | |
lookup_field = 'id' | |
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
#!/usr/bin/env python | |
import json | |
import boto3 | |
def create_topics(topics): | |
client = boto3.client('sns') | |
results = [] |
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
#!/usr/bin/env python | |
import json | |
import boto3 | |
def get_content_file(path): | |
with open(path, 'rb') as content_file: | |
data = content_file.read() | |
return data |
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 sys | |
sys.path.append('CAMINHO_DO_PROJETO') | |
from NOME_DO_PROJETO import settings | |
from django.core.management import setup_environ | |
setup_environ(settings) |
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 import forms | |
from django.contrib.auth.forms import UserCreationForm | |
class FormSignUp(UserCreationForm): | |
email = forms.CharField(max_length=254, required=True, widget=forms.EmailInput()) | |
class Meta: | |
model = User | |
fields = [ |
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
#!/bin/bash | |
set -e | |
apps=( "olist-orders-api" "olist-freights-api" "olist-correios-api" ) | |
order_exclude_tables=( "olist_orders_orderhistory" "olist_orders_orderhistory" "seller_orders_sellerorderhistory" "seller_orders_sellerorderitemhistory" ) | |
correios_exclude_tables=( ) | |
freights_exclude_tables=( ) | |
get_exclude_params() { |
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 import forms | |
from django.contrib.auth import get_user_model, password_validation | |
User = get_user_model() | |
class RegisterForm(forms.ModelForm): | |
password2 = forms.CharField( | |
label="Confirmacao", |
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
#!/usr/bin/env python | |
# encoding: utf-8 | |
import re | |
import sys | |
import requests | |
API_CEP = 'http://api.postmon.com.br/v1/cep/{}' | |
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 User(models.Model): | |
email = models.EmailField() | |
endereco = models.ForeignKey(Endereco) | |
class State(models.Model): | |
name = models.CharField() | |
class City(models.Model): | |
name = models.CharField() |
OlderNewer