S
S
sortfact3332020-10-28 17:00:43
Django
sortfact333, 2020-10-28 17:00:43

Why is the command not finding the attribute?

I'm trying to get additional fields.

a = Article.objects.get(id = article_id)
  a.articleadd_set.all()

But django says it didn't find the articleadd_set attribute.
The model name is ArticleAdd. with relation OneToOneField to Article
How do I know if I wrote the model correctly or if any additional field is assigned to Article. to know where I made a mistake.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-10-28
@sortfact333

If the relation is one to one, then the reverse relation will be without _set.
PS Very strange name for the ArticleAdd model.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question