error message 1 error message 2
@login_required
def topic(request, topic_id):
topic = Topic.objects.get(id=topic_id)
_check_topic_owner(request)
entries = topic.entry_set.order_by('-date_added')
context = {'topic': topic, "entries": entries}
return render(request, 'learning_logs/topic.html', context)
def _check_topic_owner(request):
if topic.owner != request.user:
raise Http404
The problem is when im trying open page in web app. Is thow problem "'function' object has no attribute 'owner'"
CodePudding user response:
Try changing the name of the variable topic
to a different name that doesn't clash with the function called topic.