Maroua
this is the main page the buttons are in the nav
Doragonsureiyā
this is the main page the buttons are in the nav
Rule 5️⃣: Never post walls of text or screen photos. Use paste bins like https://dpaste.org, https://hastebin.com, https://bin.kv2.dev or your favorite one!
Charly
i didnt get how to do it sorry
https://t.me/django/280328
Maroua
like this?
Charly
like this?
No, in the sites mentioned there
Maroua
https://dpaste.org/6vadC
Maroua
https://dpaste.org/8QU8F
Maroua
https://dpaste.org/4mpwA
Maroua
https://dpaste.org/wC7U2
park seo joon
https://dpaste.org/4mpwA
First instead of validating your logout from the template why not write views for it
park seo joon
Secondly did you mean if a user login he should be redirected to the home page but in instead a user login and he is redirected to the logout?
Maroua
First instead of validating your logout from the template why not write views for it
i didnt create any template for the logout i just want is to redirect to the homepage
park seo joon
i didnt create any template for the logout i just want is to redirect to the homepage
It's not compulsory you must create a template for logout
Maroua
Secondly did you mean if a user login he should be redirected to the home page but in instead a user login and he is redirected to the logout?
no , if a user login he should be redirected to the home page + the login button changes into logout button , but when i login it is redirected to the main page but the button doesnt change
Maroua
It's not compulsory you must create a template for logout
yeah , cuz once i logout i just want it to be redirected to the home page and the logout button changes into login again
park seo joon
exactly yes
How did you want the button to change? Did you give it some animation
Maroua
it works some times and it turns to logout button but once i logout and login again , it is redirected to the home page but the button doesnt change again
park seo joon
yeah , cuz once i logout i just want it to be redirected to the home page and the logout button changes into login again
If you should import login required and write views for logout instead of using template
park seo joon
If you are writing view for logout you should give it permission for login required so that a user who has not registered can register before they can login and if they logout redirect them to login
Maroua
https://dpaste.org/4mpwA
i did create view for the logout its the third line
park seo joon
Use the return redirect('logout')
Maroua
https://dpaste.org/xOZuV
Maroua
This is urls
sorry my fault this is views
park seo joon
sorry my fault this is views
https://hastebin.com/share/muwaqareso.python
Maroua
https://dpaste.org/6vadC
i think the problem is in the html , this is the home page where i said if the user is loged in than the button changes
park seo joon
Your vies should be like this
Maroua
i tried it and it didnt work the button still doesnt change ,
park seo joon
You template is not supposed to be a form because you didn't write form for it
Maroua
it doesnt even change into logout so i cant make sure that after logout it leads me to the login again
park seo joon
It's supposed to be a link
Maroua
how??
park seo joon
you mean the login form ??
Logout i mean https://hastebin.com/share/eqojiqixor.xml
park seo joon
Maroua
Logout i mean https://hastebin.com/share/eqojiqixor.xml
oh i got it , i chnged it into <a> like the login but it still , i also changed the views and the probleme still the same
park seo joon
First you need to import logout like this from django.contrib.auth import logout
park seo joon
yes i did it
Send the code
Maroua
Send the code
https://dpaste.org/vCSg2
park seo joon
https://dpaste.org/vCSg2
Send your url and template
Maroua
the login template or the homepage ?
Maroua
this is the urls
Maroua
https://dpaste.org/QMVC5
park seo joon
the login template or the homepage ?
Send template where you have your logout
Maroua
https://dpaste.org/gyHpB
Maroua
this is the homepage i set the logout condition in the navbar
park seo joon
https://dpaste.org/QMVC5
Here you use sign as the name for signin but you pass signin on the logout view instead of sign
Maroua
i fixed it it sign now
park seo joon
Logout i mean https://hastebin.com/share/eqojiqixor.xml
In your template delete from line 24 to 30 and replace with this
Maroua
an error shows when i did it , 'logout_view' not found even tho i wrote the view as you told me
Maroua
the error is here <a href="{% url 'logout_view' %}">
Maroua
yes
park seo joon
Yours is logout so you should put logout I'm only giving you example
Maroua
it workingg
Maroua
thank you sooo much i'm sorry for taking your time
Maroua
i was searching for days but i couldnt find anything helpful , thank you so much
Mohammad Hossein
Hi! I learned the 8 parts tutorial of the first steps in the documentation. What do you suggest to learn next? Do you think creating a practical project is good?
Mohammad Hossein
And by learned, do you mean you've tried it out?
Yep i just tried to understand its codes and did all of the parts on my computer (Actually except testing). But I think I need a little more practice to leave no ambiguity in my mind
markit
Hello, perhaps you can please tell me how to configure django background task https://django-background-tasks.readthedocs.io/en/latest/ to complete the task on the last day of each month (send statistics to users by email)
Mohammad Hossein
Yes projects are the Best
Thanks for your response.
I DARE
I need help with my project
I DARE
I was able to access my homepage and other urls like localhost:8000/topics/1/ But I can't access localhost:8000/topics It keeps showing this error
I DARE
Ohhhhhh I can't send screenshot