environment Python 3.5.0 Django 1.9.2
If you want to get the category of the specified article and use the method
views.py
def edit(request, article_id):
category = Category.objects.filter(article=article_id)
category_foo = category.foo()
filter
views.py
def edit(request, article_id):
category = Category.objects.get(article=article_id)
category_foo = category.foo()
Change to get.
Recommended Posts