Incorrect syntax used
Correction
Views.py:
from .models import Topic
def index(request):
"""the homepage for the homepage"""
return render(request, 'homepage/index.html', name="something")
Base.html:
<a href='{% url ' something ' %}'>main</a>
Follow the same process for every view and template
Sent via the BlackBerry Hub for Android
Original Message
From: [email protected]
Sent: June 26, 2018 20:08
To: [email protected]
Reply-to: [email protected]
Subject: NoReverseMatch at / ' homepage' is not a registered namespace
I am building my django app from base.html and with child themes
and get these errors:
any help woud be appreciated.
Tim
NoReverseMatch at /
' homepage' is not a registered namespace
Request Method: GET
Request URL: http://localhost:8000/
Django Version: 2.0.6
Exception Type: NoReverseMatch
Exception Value:
' homepage' is not a registered namespace
Exception Location:
/Users/timvogt/newdjango/lib/python3.6/site-packages/django/urls/base.py in
reverse, line 86
Python Executable: /Users/timvogt/newdjango/bin/python3
Python Version: 3.6.5
Python Path:
['/Users/timvogt/coolapp',
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip',
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6',
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload',
'/Users/timvogt/newdjango/lib/python3.6/site-packages']
Server time: Mon, 25 Jun 2018 20:46:07 +0000
Error during template rendering
In template /Users/timvogt/coolapp/homepage/templates/homepage/base.html, error
at line 2
' homepage' is not a registered namespace
1 <p>
2 <a href='{% url ' homepage:index ' %}'>main</a>
3 <a href='{% url ' homepage:topics ' %}'>topics</a> {% block content %} {%
endblock content %}
vieuws.py
from django.shortcuts import render
from .models import Topic
def index(request):
"""the homepage for the homepage"""
return render(request, 'homepage/index.html')
def topics(request):
"""show all topics"""
topics = Topic.objects.order_by('date_added')
context = {'topics': topics}
return render(request, 'homepage/topics.html', context)
# Create your views here.
base.html
<p>
<a href='{% url ' homepage:index ' %}'>main</a>
<a href='{% url ' homepage:topics ' %}'>topics</a> {% block content %} {%
endblock content %}
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/588239f0-581b-4764-bd96-51d23faa5ab3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/9o46lsbfaifanrbq38sfl9bv.1530078835571%40gmail.com.
For more options, visit https://groups.google.com/d/optout.