Skip to content

Commit 92a4511

Browse files
committed
added registration templates
1 parent 448672b commit 92a4511

19 files changed

+184
-1
lines changed

SNB/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __unicode__(self):
2626
class Category(models.Model):
2727
category = models.CharField(max_length=25)
2828
name = models.CharField(max_length=100)
29-
description = models.CharField(max_length=500,null=True,blank=True)
29+
description = models.TextField(max_length=1000,null=True,blank=True)
3030

3131
def __unicode__(self):
3232
return "%s - %s" % (self.category,self.name)

settings.py

+8
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,11 @@
8585
)
8686

8787
ACCOUNT_ACTIVATION_DAYS = 7
88+
EMAIL_HOST = 'smtp.gmail.com'
89+
EMAIL_HOST_USER = 'oskar@oskarstephens.com'
90+
EMAIL_HOST_PASSWORD = 'EeCs04EE'
91+
EMAIL_PORT = 587
92+
EMAIL_USE_TLS = True
93+
DEFAULT_FROM_EMAIL = 'oskar.stephens@gmail.com@localhost'
94+
LOGIN_REDIRECT_URL = '/'
95+

templates/base.html

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{% load i18n %}
2+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5+
6+
<head>
7+
<link rel="stylesheet" href="/style.css" />
8+
<title>{% block title %}User test{% endblock %}</title>
9+
</head>
10+
11+
<body>
12+
<div id="header">
13+
{% block header %}
14+
<a href="{% url index %}">{% trans "Home" %}</a> |
15+
16+
{% if user.is_authenticated %}
17+
{% trans "Logged in" %}: {{ user.username }}
18+
(<a href="{% url auth_logout %}">{% trans "Log out" %}</a> |
19+
<a href="{% url auth_password_change %}">{% trans "Change password" %}</a>)
20+
{% else %}
21+
<a href="{% url auth_login %}">{% trans "Log in" %}</a>
22+
{% endif %}
23+
<hr />
24+
{% endblock %}
25+
</div>
26+
27+
<div id="content">
28+
{% block content %}{% endblock %}
29+
</div>
30+
31+
<div id="footer">
32+
{% block footer %}
33+
<hr />
34+
{% endblock %}
35+
</div>
36+
</body>
37+
38+
</html>

templates/index.html

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{% extends "base.html" %}
2+
{% load i18n %}
3+
4+
{% block content %}
5+
Index page
6+
{% endblock %}

templates/registration/activate.html

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{% extends "base.html" %}
2+
{% load i18n %}
3+
4+
{% block content %}
5+
6+
{% if account %}
7+
8+
<p>{% trans "Account successfully activated" %}</p>
9+
10+
<p><a href="{% url auth_login %}">{% trans "Log in" %}</a></p>
11+
12+
{% else %}
13+
14+
<p>{% trans "Account activation failed" %}</p>
15+
16+
{% endif %}
17+
18+
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{% load i18n %}
2+
{% trans "Activate account at" %} {{ site.name }}:
3+
4+
http://{{ site.domain }}{% url registration_activate activation_key %}
5+
6+
{% blocktrans %}Link is valid for {{ expiration_days }} days.{% endblocktrans %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{% load i18n %}{% trans "Account activation on" %} {{ site.name }}

templates/registration/login.html

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{% extends "base.html" %}
2+
{% load i18n %}
3+
4+
{% block content %}
5+
<form method="post" action=".">
6+
{{ form.as_p }}
7+
8+
<input type="submit" value="{% trans 'Log in' %}" />
9+
<input type="hidden" name="next" value="{{ next }}" />
10+
</form>
11+
12+
<p>{% trans "Forgot password" %}? <a href="{% url auth_password_reset %}">{% trans "Reset it" %}</a>!</p>
13+
<p>{% trans "Not member" %}? <a href="{% url registration_register %}">{% trans "Register" %}</a>!</p>
14+
{% endblock %}

templates/registration/logout.html

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{% extends "base.html" %}
2+
{% load i18n %}
3+
4+
{% block content %}
5+
<p>{% trans "Logged out" %}</p>
6+
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{% extends "base.html" %}
2+
{% load i18n %}
3+
4+
{% block content %}
5+
<p>{% trans "Password changed" %}</p>
6+
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{% extends "base.html" %}
2+
{% load i18n %}
3+
4+
{% block content %}
5+
<form method="post" action=".">
6+
{{ form.as_p }}
7+
8+
<input type="submit" value="{% trans 'Submit' %}" />
9+
</form>
10+
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{% extends "base.html" %}
2+
{% load i18n %}
3+
4+
{% block content %}
5+
6+
<p>{% trans "Password reset successfully" %}</p>
7+
8+
<p><a href="{% url auth_login %}">{% trans "Log in" %}</a></p>
9+
10+
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{% extends "base.html" %}
2+
{% load i18n %}
3+
4+
{% block content %}
5+
6+
{% if validlink %}
7+
8+
<form method="post" action=".">
9+
{{ form.as_p }}
10+
11+
<input type="submit" value="{% trans 'Submit' %}" />
12+
</form>
13+
14+
{% else %}
15+
16+
<p>{% trans "Password reset failed" %}</p>
17+
18+
{% endif %}
19+
20+
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{% extends "base.html" %}
2+
{% load i18n %}
3+
4+
{% block content %}
5+
<p>{% trans "Email with password reset instructions has been sent." %}</p>
6+
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% load i18n %}
2+
{% blocktrans %}Reset password at {{ site_name }}{% endblocktrans %}:
3+
{% block reset_link %}
4+
{{ protocol }}://{{ domain }}{% url auth_password_reset_confirm uidb36=uid, token=token %}
5+
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{% extends "base.html" %}
2+
{% load i18n %}
3+
4+
{% block content %}
5+
<form method="post" action=".">
6+
{{ form.as_p }}
7+
8+
<input type="submit" value="{% trans 'Submit' %}" />
9+
</form>
10+
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{% extends "base.html" %}
2+
{% load i18n %}
3+
4+
{% block content %}
5+
<p>{% trans "You are now registered. Activation email sent." %}</p>
6+
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{% extends "base.html" %}
2+
{% load i18n %}
3+
4+
{% block content %}
5+
<form method="post" action=".">
6+
{{ form.as_p }}
7+
8+
<input type="submit" value="{% trans 'Submit' %}" />
9+
</form>
10+
{% endblock %}

urls.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django.conf.urls.defaults import *
2+
from django.views.generic.simple import direct_to_template
23

34
# Uncomment the next two lines to enable the admin:
45
# from django.contrib import admin
@@ -16,4 +17,6 @@
1617
# Uncomment the next line to enable the admin:
1718
(r'^admin/', include(admin.site.urls)),
1819
(r'^accounts/', include('registration.backends.default.urls')),
20+
(r'^$', direct_to_template,
21+
{ 'template':'index.html' }, 'index'),
1922
)

0 commit comments

Comments
 (0)