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 would like to know how to do a select , as below, and convert the result to JSON:
select a.nome,a.marca,b.categ_desc from Produto a inner join Categ b on a.id=b.id
I'm doing this, but it does not contain the description of the categ
table.
Produto.objects.select_related()