hello guys
On Wednesday, May 13, 2020 at 6:45:02 PM UTC+1, Ali Ahammad wrote:
-- i have tried email_template_name = 'registration/password_reset_email.html', success_url = reverse_lazy('registration:password_reset_done') but still no luck. i tried to edit template_name='accounts/reset_password.html, seems like django is reaching out to this hml file. but when i delete all the code or kept all the code inside reset_password.html, it won't have any effect. seems like whtever i write it isn't rendering to base.html. what should be the effective solution?
please help
On Wednesday, May 13, 2020 at 6:45:02 PM UTC+1, Ali Ahammad wrote:
hello everyonei am trying to make a blog where i am trying to customize password reset forms.here is my bloggapp/urls.py:from django.contrib importadmin from django.urls import path,include from django.views.generic.base import TemplateView from django.contrib.auth import views as auth_viewsurlpatterns = [path('admin/', admin.site.urls), path('accounts/', include('accounts.urls' )),#path('users/', include('django.contrib.auth.urls')), path('accounts/login/',auth_views.LoginView.as_view(t emplate_name ='registration/login.html' ), name='login'),path('accounts/logout/',auth_views.LogoutView.as_view( template_name ='logout.html'),name ='logout'),path('', include('blog.urls' )),path('password-reset/',auth_views.PasswordResetView.as_view (template_name='registration/password_reset. ),html' name='password_reset'), path('password-reset/done/' ,auth_views.PasswordResetDoneView.as_view (template_name='registration/password_reset_ ),done.html' name='password_reset_done' ),path('password-reset-confirm/<uidb64>/<token>/' ,auth_views.PasswordResetConfirmView.as_ view( template_name='registration/password_reset_ confirm.html' ),name='password_reset_confirm' ),path('password-reset-complete/' ,auth_views.PasswordResetCompleteView.as_ view( template_name='registration/password_reset_ complete.html' ),name='password_reset_complete' ),]http://localhost:8000/password-reset/ this page is showing the html form i have wrote in registration/password_reset.html directory which is under accounts app. in the accounts app there is templates folder and in this folder i have kept base.html. in the same folder i have created registration folder where i kept login.html and password_reset.html.i have set up my email smtp in sendgrid and it is working. besides registration/login.html,templates/signup.html files are working. i am including my base.html file also:<!doctype html><html lang="en"><head><!-- Required meta tags --> <meta charset="utf-8"><meta name="viewport" content ="width=device-width,initial-scale=1, shrink-to-fit=no" ><!-- Bootstrap CSS -->bootstrap.min.css" integrity="sha384-MCw98/ SFnGE8fJT3GXwEOngsV7Zt27NXFoao ApmYm81i\ uXoPkFOJwJ8ERdknLPMO" crossorigin ="anonymous"><title>{% block title %}Newspaper App{% endblock title %}</title> </head><body><nav class="navbar navbar-expand-md navbar-dark bg-dark >mb-4" <a class="navbar-brand" href="{% url 'home' %}"> Newspaper</a><button class="navbar-toggler" type="button"data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation" ><span class="navbar-toggler-icon" ></span></button><div class="collapsenavbar-collapse" id="navbarCollapse" >{% if user.is_authenticated %}<ul class="navbar-nav ml-auto" ><li class="nav-item" ><a class="nav-link dropdown-toggle" href="#" id="userMenu" data-toggle ="dropdown" aria-haspopup ="true" aria-expanded="false" >{{ user .username }}</a><div class="dropdown-menu dropdown-menu- right" aria-labelledby="userMenu" ><a class ="dropdown-item" href="{%url 'password_reset'%}" >Changepassword</a> <div class ="dropdown-divider"></div><a class ="dropdown-item" href="{%url 'logout' %}" >Log Out</a> </div></li></ul>{% else %}<form class="form-inline ml-auto" ><a href="{%url 'login' %}" class="btnbtn-outline-secondary" >Log In</a><a href="{%url 'signup' %}" class="btnbtn-primary ml-2" >Sign up</a> </form>{% endif %}</div></nav><div class="container">{% block content %}{% endblock content %}</div><!-- Optional JavaScript --> <!-- jQuery first, thenPopper.js, then Bootstrap JS - -> <script src="https://code.jquery.com/jquery-3.3.1.slim. " integrity="sha384-q8i/min.js X+ 965DzO0rT7abK41JStQIAqVgRVzpbz o5smXKp4\ YfRvH+8abtTE1Pi6jizo" crossorigin ="anonymous"></script>1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+ 9J3UJ46jBk0WLaUAdn689aCwoqbB\ JiSnjAK/l8WvCWPIPm49" crossorigin="anonymous" ></script>js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+ MXmPNIyE6ZbWh2IMqE241rYiqJxyMi Z\ 6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script> </body></html>and templates/home.html also:{% extends 'base.html' %}{% block title %}Home{% endblock title %}{% block content %}{% if user.is_authenticated %}Hi {{ user.username }}!<p><a href="{% url 'logout' %}" >Log Out</a></p>{% else %}<p>You are not logged in</p><a href="{% url 'login' %}">Log In</a> | <a href="{% url 'signup' %}">Sign Up</a> {% endif %}{% endblock content %}but the below mentioned html files are not showing in the browser but they are coming as django administration view.<!-- templates/registration/password_reset_complete.html - -> {% extends 'base.html' %}{% block title %}Passwordreset complete{% endblock titl e %}{% block content %}<h1>Password reset complete</h1 ><p>Your new password has beenset. You can log in now on the <a href="{% url 'login' %}">log inpage</a>.</p> {% endblock content %}<!-- templates/registration/password_reset_confirm.html -- > {% extends "base.html" %}{% load crispy_forms_tags %}{% block content %}<div class="content-section" ><form method="POST">{% csrf_token %}<fieldset class="form-group" ><legend class="border-bottom mb-4" >ResetPassword</legend> {{ form|crispy}} </fieldset><div class="form-group" ><button class="btn btn-outline-info" type="submit" >Reset Password</button> </div></form></div>{% endblock content %}<!-- templates/registration/password_reset_done.html --> {% extends "base.html" %}{% block content %}<div class="alert alert-info" >Your password hasbeen set. </div><a href="{% url 'login' %}" >Sign In Here</a>{% endblock content %}i don't what i have made wrong. will you please point me in the right direction? i really need this.
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7c4f7cf6-6884-48c8-b4fd-9534c8864bd1%40googlegroups.com.
No comments:
Post a Comment