since you are using .first() in the query, it will return only 1 object so
I don't think using a for loop our 'category' in template will work
On Mon, 18 Oct 2021 at 18:04, Katharine Wong
wrote:
> Hi all,
>
> There is a question when I use distinct().
> When I try to use the ORM(distinct & value
Hi all,
There is a question when I use distinct().
When I try to use the ORM(distinct & value), I cannot get the value of the
attribute(foreign key).
models.py
class Category(models.Model):
category = models.CharField(max_length=20)
class Article(models.Model):
category = models.ForeignKey(C
2 matches
Mail list logo