Skip to content

Instantly share code, notes, and snippets.

View alisonamerico's full-sized avatar
🐍
💻 Working from 🏠

Alison Américo alisonamerico

🐍
💻 Working from 🏠
  • Recife, Brasil
View GitHub Profile
@alisonamerico
alisonamerico / docker_django
Created October 6, 2019 01:17
docker_django
# Dockerfile
# Pull base image
FROM python:3.7-buster
# create and set working directory
RUN mkdir /code
WORKDIR /code
# Add current directory code to working directory
# views.py
from django.db.models import F
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.status import HTTP_201_CREATED, HTTP_409_CONFLICT, HTTP_400_BAD_REQUEST
from rest_framework import status
from .models import GlobalVariable
from .serializers import GlobalVariablesSerializer
# views.py
from django.db.models import F
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.status import HTTP_201_CREATED, HTTP_409_CONFLICT, HTTP_400_BAD_REQUEST
from .models import GlobalVariable, Variable, Unity, State
from .serializers import GlobalVariablesSerializer, StateSerializer
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<div id="exercise">
<!-- 1) Fill the <p> below with your Name and Age - using Interpolation -->
<p>VueJS is pretty cool - {{ name }} ({{ age }})</p>
<!-- 2) Output your age, multiplied by 3 -->
<p>{{ age * 3}}</p>
<!-- 3) Call a function to output a random float between 0 and 1 (Math.random()) -->
<p>{{ random() }}</p>
<!-- 4) Search any image on Google and output it here by binding the "src" attribute -->
```
views.py
from django.db.models import F
from rest_framework.exceptions import ValidationError
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.status import HTTP_201_CREATED, HTTP_409_CONFLICT, HTTP_400_BAD_REQUEST
from .models import GlobalVariable, Variable, Unity, State
from django.db import models
class Country(models.Model):
id = models.AutoField(db_column='ID_COUNTRY', primary_key=True)
name = models.CharField(db_column='NAME', max_length=30)
initials = models.CharField(db_column='INITIALS', max_length=4, blank=True, null=True)
class Meta:
managed = False
db_table = 'COUNTRY'
# models.py
from django.db import models
class Country(models.Model):
id = models.AutoField(db_column='ID_COUNTRY', primary_key=True)
name = models.CharField(db_column='NAME', max_length=30)
initials = models.CharField(db_column='INITIALS', max_length=4, blank=True, null=True)
class Meta:
# Generated by Django 2.0.5 on 2020-01-13 18:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('schemas', '0021_add_packing_type_and_allow_negotiation'),
]
{
"data":{
"version":"v1",
"negotiation":{
"batch_type":"crusher_run"
},
"characteristics":{
"species":"arabica",
"origin":155,
"""
Problema.
Uma entrada de valores numéricos (uma lista deles)
3x -> Queijo
5x -> Goiabada
3x e 5x -> romeu e Julieta
Base dos testes: