Sunday, May 16, 2010

Django Modular Admin Part 2

I just realized that alot of the functionality that the admin login has is not part of django.contrib.auth but is only in the admin.

A couple of things I have figure out as a result with form validation errors in the template.
{{ form.non_field_errors }} is for a ValidationError that is for the whole form.

A snippet of my login.html template


<div id="welcome_login" title="Welcome To My Site"> 
  <p><b>Admin Login</b></p>
  <form action="." method="post" enctype="multipart/form-data" class="forms" name="form" >{% csrf_token %}
   {% if form.non_field_errors %}
   <div class="response-msg error ui-corner-all">
    <span>Error message</span>
    {{ form.non_field_errors }}
   </div>
   {% endif %}
     <ul> 
    <li> 
     <label for="id_username" class="desc">{% trans 'Username:' %}</label> 
     <div>
      {% if form.username.errors %}
      <div class="response-msg error ui-corner-all">
       <span>Error message</span>
       {{ form.username.errors }}
      </div>
      {% endif %}
      <input type="text" tabindex="1" maxlength="255" value="" class="field text full" name="username" id="email" />

     </div> 
    </li> 
    <li> 
     <label for="id_password" class="desc">{% trans 'Password:' %}</label>
     <div> 
      {% if form.password.errors %}
      <div class="response-msg error ui-corner-all">
       <span>Error message</span>
       {{ form.password.errors }}
      </div>
      {% endif %}
      <input type="password" tabindex="1" maxlength="255" value="" class="field text full" name="password" id="password" />
      <input type="hidden" name="this_is_the_login_form" value="1" />
     </div> 
    </li> 
   </ul> 
  </form> 
 </div>

More to come on django auth

No comments: