Link does not work correctly

42 views
Skip to first unread message

Barkalez XX

unread,
Mar 10, 2019, 10:28:06 AM3/10/19
to Django users

In the browser, when I'm in "http://127.0.0.1:8000/" and click in register it takes me to "http://127.0.0.1:8000/register" and it works correctly, but if I'm in "http: //127.0.0.1:8000/about/ "and click on register takes me to" http://127.0.0.1:8000/about/register/ "instead of" http://127.0.0.1:8000/register " . My project : https://github.com/barkalez/recetas

Gil Obradors

unread,
Mar 10, 2019, 1:22:29 PM3/10/19
to django...@googlegroups.com
Hi
I can't give you the exactly response,

But I know that you are playing with href=url direct, without using django template code
I suggest you to change de href of register from about, to a href with django template code:
Something like : href="{% static 'greenfapp/main.css' %}
But I can't see at urls.py from user app, so I don't know if user apps register view has any name associociated to

You must write something like href="{ url :'recetas-home' % }  ( nor direct url)


Good luck


Missatge de Barkalez XX <bark...@gmail.com> del dia dg., 10 de març 2019 a les 15:28:

In the browser, when I'm in "http://127.0.0.1:8000/" and click in register it takes me to "http://127.0.0.1:8000/register" and it works correctly, but if I'm in "http: //127.0.0.1:8000/about/ "and click on register takes me to" http://127.0.0.1:8000/about/register/ "instead of" http://127.0.0.1:8000/register " . My project : https://github.com/barkalez/recetas

--
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 django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
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/f77b7e65-3e0c-4f29-b951-d052e669fe20%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Barkalez XX

unread,
Mar 12, 2019, 1:30:38 PM3/12/19
to Django users

Hi

You can see my code in:


I have it like this:

<a class="nav-item nav-link" href="{% url 'register' %}">Register</a>

Amirat A

unread,
Mar 24, 2019, 12:53:42 PM3/24/19
to Django users
Hey! so i viewed your code, and on your about page you have this:



<a class="nav-item nav-link" href="register">Register</a>

 (i found this here : recetas/greenf/greenfapp/templates/greenfapp/base.html)



but if you change it to what you suggested it should work perfectly fine :



<a class="nav-item nav-link" href="{% url 'register' %}">Register</a>

hope i could help?
Reply all
Reply to author
Forward
0 new messages