Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendring Data to Templates #14

Open
bermaoi opened this issue Oct 15, 2021 · 1 comment
Open

Rendring Data to Templates #14

bermaoi opened this issue Oct 15, 2021 · 1 comment

Comments

@bermaoi
Copy link

bermaoi commented Oct 15, 2021

Hi
i have problem with passing data from view to single-project.html

`this is the code on single-project.html
<
{% extends 'main.html' %}
{% block content %}

hello

\\\\ i have add this to know if page loading good and it is loaded

{{project.title}}


{{project.description}}

{% endblock %}>

the View code

def project(request,pk):
projectObj = None
for i in projectslist:
if i['id'] == pk:
projectObj = i
return render(request,'projects/single-project.html', {'projectObj':projectObj})

i'd lik to know what is wrong

@das-saptarshi
Copy link

Hi @bermaoi. From the code that you have provided I can see that the issue is with the naming of the key for projectObj in context. You have used the key as 'projectObj' and in 'single-project.html' you are referencing it as 'project'.
Just change the key to 'project' or reference the projectObj using 'projectObj'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants