我有两个表,一个是Treinamento(训练),另一个是Entidade(实体),我真的需要知道如何显示这两个模型类的结果,例如两个模型之间的内部联接,任何人都可以帮帮我吗?
这是针对在sqlite3中运行的Windows 10(本地主机)
from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator
from phone_field import PhoneField
from datetime import time
# Create your models here.
class Entidade(models.Model):
id = models.AutoField(primary_key=True)
nome_entidade = models.CharField(max_length=70)
razao_social = models.CharField(max_length=70)
codigo_sap = models.PositiveIntegerField(default=0, blank=False)
pessoa_contato = models.CharField(max_length=20)
email = models.EmailField(max_length=254, blank=False, unique=True, error_messages={'required': 'Porfavor digite seu e-mail.', 'unique': 'Já existe esse e-mail cadastrado.'},)
phone = PhoneField(blank=True, help_text='Seu numero de telefone')
cep = models.PositiveIntegerField(default=0,blank=False)
endereço = models.CharField(max_length=100)
cidade = models.CharField(max_length=100)
estado = models.CharField(max_length=100)
data_registro = models.DateTimeField(blank=True)
def __str__(self):
return self.nome_entidade
from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator
from phone_field import PhoneField
from localflavor.br.forms import BRZipCodeField
from datetime import time
Create your models here.
class Treinamento(models.Model):
id = models.AutoField(primary_key=True)
nome_treinamento = models.CharField(max_length=50)
categoria = models.CharField(max_length = 50)
conteudo = models.TextField()
requisito = models.CharField(max_length=50)
recursos = models.CharField(max_length=50)
carga_horaria = models.TimeField(auto_now=False, auto_now_add=False)
tipo = models.CharField(max_length=50)
local = models.CharField(max_length=50)
def __str__(self):
return self.nome_treinamento
该准则分为不同的模型和应用。
我不知道该怎么做,或者这是否可行。