1
model py.
class Produto(models.Model):
nome=models.CharField('nome', max_length=100)
marca=models.CharField('nome', max_length=100)
categ=models.ForeignKey(Produto, verbose_name='Produto')
class Categ(models.Model):
categ_desc=models.CharField('categ', max_length=100)
I wonder how I do for a select, as below, and convert to JSON the result:
select a.nome,a.marca,b.categ_desc from Produto a inner join Categ b on a.id=b.id
I’m doing so, but it doesn’t bring the description of the table categ
.
Produto.objects.select_related()
That’s right the part
a.id = b.id
? Would not bea.categ = b.id
?– Woss
Yes misspelled. But I need with Django to display the information of the 2 tables.
– Luis Vitorio