-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
52 additions
and
79 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,7 @@ | ||
from django.db import models | ||
|
||
# Create your models here. | ||
class Estado(models.Model): | ||
nome = models.CharField(max_length=100) | ||
sigla = models.CharField(max_length=2, unique=True) | ||
|
||
def __str__(self): | ||
return self.sigla | ||
|
||
class Cidade(models.Model): | ||
nome = models.CharField(max_length=28) | ||
estado = models.ForeignKey(Estado, on_delete=models.CASCADE, related_name='cidades') | ||
|
||
class Meta: | ||
unique_together = (('nome', 'estado'),) | ||
|
||
class Enterprise(models.Model): | ||
cnpj = models.CharField(max_length=14, unique=True) | ||
nome = models.CharField(max_length=50) | ||
email = models.EmailField(unique=True) | ||
cidades = models.ManyToManyField(Cidade, related_name='empresas') | ||
email = models.EmailField(unique=True) |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
from django.shortcuts import render | ||
|
||
# Create your views here. | ||
def cadastro_empresa(request): | ||
if request.method == 'POST': | ||
cnpj = request.POST['cnpj'] | ||
nome = request.POST['nomeEmpresa'] | ||
email = request.POST['emailEmpresa'] |
This file contains 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
Binary file not shown.
This file contains 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
This file contains 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