Commits

Colin Copeland committed 94aad01

add login view/templates

Comments (0)

Files changed (5)

lib/copelco/settings.py

 STATICFILES_DIRS = (
     '%s/static' % PROJECT_PATH,
 )
+
+LOGIN_REDIRECT_URL = '/'

lib/copelco/settings_production.py

     }
 }
 
-DEBUG = True
+DEBUG = False
 TEMPLATE_DEBUG = DEBUG
 
 STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'

lib/copelco/templates/base_site.html

                         <li class='name'>Hi, {{ user.first_name }}</li>
                     {% endif %}
                     {% if user.is_staff %}
+                        <li><a href='{% url house-map %}' title='Houses'>Houses</a></li>
                         <li><a href='{% url admin:index %}' title='Admin'>Admin</a></li>
                     {% endif %}
-                    <li><a href='{% url admin:logout %}' title='Logout'>Logout</a></li>
+                    <li><a href='{% url auth_logout %}' title='Logout'>Logout</a></li>
                 </ul>
                 {% endif %}
             </div>

lib/copelco/templates/registration/login.html

+{% extends "base.html" %}
+{% block title %}Login{% endblock %}
+
+{% block content %}
+<h1>Authentication</h1>
+
+<form id='login' accept-charset='UTF-8' method='post' action=''>
+    {% csrf_token %}
+    <table class='vertical'>
+    {{ form }}
+    <tr>
+        <td>&nbsp;</td>
+        <td class='submit'>
+            <input type='submit' name='submit' value='Login &rarr;' />
+        </td>
+    </tr>
+    </table>
+</form>
+{% endblock %}

lib/copelco/urls.py

 urlpatterns = patterns('',
     url(r'^$', 'copelco.apps.default.views.home', name='home'),
     url(r'^%sadmin/' % settings.URL_PREFIX, include(admin.site.urls)),
+    url(r'^accounts/login/$', 'django.contrib.auth.views.login',
+        name='auth_login'),
+    url(r'^accounts/logout/$', 'django.contrib.auth.views.logout_then_login',
+        name='auth_logout'),
 )
 
 if settings.DEBUG:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.