Domanda

The password reset templates are stored in:

/usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/registration

However, I want to override the default templates provided my Django. I don't want to directly go to that directory and edit the template. Thus, I created password reset templates with same name in templates/registration directory. However, I am still getting the same inbuild django template. My one template password_reset_form.html looks like this:

<!DOCTYPE html>

<html lang="en">
<head>
<meta charset="utf-8">

<title>ATS | Password Reset Form</title>



<!--google web font-->
<link href='http://fonts.googleapis.com/css?family=Droid+Serif:400,400italic,700|Lato:700,300,400' rel='stylesheet' type='text/css'>

<!--style sheets-->
<link rel="stylesheet" media="screen" href="{{ STATIC_URL }}bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" media="screen" href="{{ STATIC_URL }}bootstrap/css/style.css"/>
<link rel="stylesheet" media="screen" href="{{ STATIC_URL }}bootstrap/css/static.css"/>
<style>
li
{
list-style-type: none;
padding: 0px;
margin: 0px;
}
#footer {
margin-top: 40px;
}

</style>
<!--jquery libraries / others are at the bottom-->
<script src="{{ STATIC_URL }}bootstrap/js/jquery-1.7.1.min.js" type="text/javascript"></script>
</head>
<body>
<!-- Header starts
================================================== -->
<header id="header">
  <div class="container">
    <div class="row"> 

      <!--logo starts-->
      <div class="span4"> <a href="/login/"><img src="{{ STATIC_URL }}bootstrap/img/auto.png"></a> </div>
      <!--logo ends--> 


  </div>
</header>
<div class="container">
<h2 class="lead text-center">Password Reset</h2><br /> <br />



<form action="" class="well span10" method="post">
{% csrf_token %}
{% block content %}
<p class="text-info text-center"><strong>Forgotten your password? Enter your e-mail address below, and we'll e-mail instructions for setting a new one.</strong></p>
<span class="text-error text-center"><strong> {{ form.email.errors }}</strong></span><br/>
<p class="text-center"><label for="id_email">Enter your E-mail address:</label> {{ form.email }}</p> 
<p class="text-center"><button class="btn btn-success">Reset my Password</button></p>
</form>
{% endblock %}
</div>
<footer id="footer">
  <div class="container">
    <div class="row"> 

      <!--small intro and copyright starts-->
      <div class="span7">
        <a data-toggle="tab" href="/how_it_works/">How it works? &nbsp; &nbsp;</a> 
        <a data-toggle="tab" href="/how_it_works/">Terms and Conditions &nbsp; &nbsp;</a> 
        <a data-toggle="tab" href="/how_it_works/">How to use? </a> <br /><br />
        <p class="copyright"> ©2013 Automatic Text Summarization(ATS) </p>
      </div>

Is there something I am missing in the template?

È stato utile?

Soluzione

Have you placed your template in your apps directory? If so specify your app before django.contrib.admin in INSTALLED_APP setting.

If you have placed the template in some other folder, verify you have appropriately added the directory in TEMPLATE_DIRS and in filesystem loader is before _app_directories _loader in TEMPLATE_LOADERS.

So it should be

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
    )

More reference at Template loaders

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top