OOdles of templates

This commit is contained in:
Daniel Greenfeld 2013-08-16 14:07:28 +02:00
parent 2d6d2c0e65
commit 4dd2a3c78f
51 changed files with 664 additions and 7 deletions

View File

@ -201,9 +201,10 @@ INSTALLED_APPS += (
########## URL Configuration ########## URL Configuration
ROOT_URLCONF = 'cl.urls' ROOT_URLCONF = '{{cookiecutter.repo_nam}}.urls'
WSGI_APPLICATION = 'cl.wsgi.application' # See: https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
WSGI_APPLICATION = '{{cookiecutter.repo_nam}}.wsgi.application'
########## End URL Configuration ########## End URL Configuration
########## django-secure ########## django-secure
@ -317,3 +318,36 @@ else:
EMAIL_USE_TLS = True EMAIL_USE_TLS = True
SERVER_EMAIL = EMAIL_HOST_USER SERVER_EMAIL = EMAIL_HOST_USER
########## END EMAIL ########## END EMAIL
########## LOGGING CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#logging
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
########## END LOGGING CONFIGURATION

View File

@ -6,7 +6,12 @@ from django.contrib import admin
admin.autodiscover() admin.autodiscover()
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^$', TemplateView.as_view(template_name='base.html')), url(r'^$',
TemplateView.as_view(template_name='pages/home.html'),
name="home"),
url(r'^$',
TemplateView.as_view(template_name='pages/about.html'),
name="about"),
# Uncomment the next line to enable the admin: # Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),

View File

@ -0,0 +1,4 @@
{% extends "base.html" %}
{% block title %}{% block head_title %}{% endblock head_title %}{% endblock title %}

View File

@ -0,0 +1,74 @@
{% extends "account/base.html" %}
{% load i18n %}
{% load url from future %}
{% block head_title %}{% trans "Account" %}{% endblock %}
{% block content %}
<h1>{% trans "E-mail Addresses" %}</h1>
{% if user.emailaddress_set.all %}
<p>{% trans 'The following e-mail addresses are associated with your account:' %}</p>
<form action="{% url 'account_email' %}" class="email_list" method="post">
{% csrf_token %}
<fieldset class="blockLabels">
{% for emailaddress in user.emailaddress_set.all %}
<div class="ctrlHolder">
<label for="email_radio_{{forloop.counter}}" class="{% if emailaddress.primary %}primary_email{%endif%}">
<input id="email_radio_{{forloop.counter}}" type="radio" name="email" {% if emailaddress.primary %}checked="checked"{%endif %} value="{{emailaddress.email}}"/>
{{ emailaddress.email }}
{% if emailaddress.verified %}
<span class="verified">{% trans "Verified" %}</span>
{% else %}
<span class="unverified">{% trans "Unverified" %}</span>
{% endif %}
{% if emailaddress.primary %}<span class="primary">{% trans "Primary" %}</span>{% endif %}
</label>
</div>
{% endfor %}
<div class="buttonHolder">
<button class="secondaryAction" type="submit" name="action_primary" >{% trans 'Make Primary' %}</button>
<button class="secondaryAction" type="submit" name="action_send" >{% trans 'Re-send Verification' %}</button>
<button class="primaryAction" type="submit" name="action_remove" >{% trans 'Remove' %}</button>
</div>
</fieldset>
</form>
{% else %}
<p><strong>{% trans 'Warning:'%}</strong> {% trans "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}</p>
{% endif %}
<h2>{% trans "Add E-mail Address" %}</h2>
<form method="post" action="" class="add_email uniForm">
{% csrf_token %}
{{ form.as_p}}
<button name="action_add" type="submit">{% trans "Add E-mail" %}</button>
</form>
{% endblock %}
{% block extra_body %}
<script type="text/javascript">
(function() {
var message = "{% trans 'Do you really want to remove the selected e-mail address?' %}";
var actions = document.getElementsByName('action_remove');
if (actions.length) {
actions[0].addEventListener("click", function(e) {
if (! confirm(message)) {
e.preventDefault();
}
});
}
})();
</script>
{% endblock %}

View File

@ -0,0 +1,4 @@
{% load account %}{% user_display user as user_display %}{% load i18n %}{% autoescape off %}{% blocktrans with current_site.name as site_name %}User {{ user_display }} at {{ site_name }} has given this as an email address.
To confirm this is correct, go to {{ activate_url }}
{% endblocktrans %}{% endautoescape %}

View File

@ -0,0 +1 @@
{% include "account/email/email_confirmation_message.txt" %}

View File

@ -0,0 +1 @@
{% include "account/email/email_confirmation_subject.txt" %}

View File

@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Confirm E-mail Address{% endblocktrans %}
{% endautoescape %}

View File

@ -0,0 +1,9 @@
{% load i18n %}{% blocktrans with site.domain as site_domain and user.username as username %}You're receiving this e-mail because you or someone else has requested a password for your user account at {{site_domain}}.
It can be safely ignored if you did not request a password reset. Click the link below to reset your password.
{{password_reset_url}}
In case you forgot, your username is {{username}}.
Thanks for using our site!
{% endblocktrans %}

View File

@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Password Reset E-mail{% endblocktrans %}
{% endautoescape %}

View File

@ -0,0 +1,37 @@
{% extends "account/base.html" %}
{% load url from future %}
{% load i18n %}
{% load account %}
{% block head_title %}{% trans "Confirm E-mail Address" %}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-md-5">
<h2>{% trans "Confirm E-mail Address" %}</h2>
{% if confirmation %}
{% user_display confirmation.email_address.user as user_display %}
<p>{% blocktrans with confirmation.email_address.email as email %}Please confirm that <a href="mailto:{{email}}">{{ email }}</a> is an e-mail address for user {{ user_display }}.{% endblocktrans %}</p>
<form method="post" action="{% url 'account_confirm_email' confirmation.key %}">
{% csrf_token %}
<button type="submit">{% trans 'Confirm' %}</button>
</form>
{% else %}
{% url 'account_email' as email_url %}
<p>{% blocktrans %}This e-mail confirmation link expired or is invalid. Please <a href="{{ email_url}}">issue a new e-mail confirmation request</a>.{% endblocktrans %}</p>
{% endif %}
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,17 @@
{% extends "account/base.html" %}
{% load i18n %}
{% load account %}
{% block head_title %}{% trans "Confirm E-mail Address" %}{% endblock %}
{% block content %}
<h1>{% trans "Confirm E-mail Address" %}</h1>
{% user_display email_address.user as user_display %}
<p>{% blocktrans with email_address.email as email %}You have confirmed that <a href="mailto:{{email}}">{{ email }}</a> is an e-mail address for user {{ user_display }}.{% endblocktrans %}</p>
{% endblock %}

View File

@ -0,0 +1,50 @@
{% extends "account/base.html" %}
{% load i18n %}
{% load account %}
{% load url from future %}
{% load crispy_forms_tags %}
{% block head_title %}{% trans "Sign In" %}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-md-5">
<h2>{% trans "Sign In" %}</h2>
{% if socialaccount.providers %}
<p>{% blocktrans with site.name as site_name %}Please sign in with one
of your existing third party accounts. Or, <a href="{{ signup_url }}">sign up</a>
for a {{site_name}} account and sign in below:{% endblocktrans %}</p>
<div class="socialaccount_ballot">
<ul class="socialaccount_providers">
{% include "socialaccount/snippets/provider_list.html" with process="login" %}
</ul>
<div class="login-or">{% trans 'or' %}</div>
</div>
{% include "socialaccount/snippets/login_extra.html" %}
{% endif %}
<form class="login" method="POST" action="{% url 'account_login' %}">
{% csrf_token %}
{{ form|crispy }}
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}
<a class="button secondaryAction" href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
<button class="btn btn-primary" type="submit">{% trans "Sign In" %}</button>
</form>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,28 @@
{% extends "account/base.html" %}
{% load url from future %}
{% load i18n %}
{% block head_title %}{% trans "Sign Out" %}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-md-5">
<h2>{% trans "Sign Out" %}</h2>
<p>{% trans 'Are you sure you want to sign out?' %}</p>
<form method="post" action="{% url 'account_logout' %}">
{% csrf_token %}
{% if redirect_field_value %}
<input type="hidden" name="{{redirect_field_name}}" value="{{redirect_field_value}}"/>
{% endif %}
<button class="btn btn-danger" type="submit">{% trans 'Sign Out' %}</button>
</form>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}You cannot remove your primary e-mail address ({{email}}).{% endblocktrans %}

View File

@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}Confirmation e-mail sent to {{email}}.{% endblocktrans %}

View File

@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}You have confirmed {{email}}.{% endblocktrans %}

View File

@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}Removed e-mail address {{email}}.{% endblocktrans %}

View File

@ -0,0 +1,4 @@
{% load account %}
{% load i18n %}
{% user_display user as name %}
{% blocktrans %}Successfully signed in as {{name}}.{% endblocktrans %}

View File

@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}You have signed out.{% endblocktrans %}

View File

@ -0,0 +1,3 @@
{% load i18n %}
{% blocktrans %}Password successfully changed.{% endblocktrans %}

View File

@ -0,0 +1,3 @@
{% load i18n %}
{% blocktrans %}Password successfully set.{% endblocktrans %}

View File

@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}Primary e-mail address set.{% endblocktrans %}

View File

@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}Your primary e-mail address must be verified.{% endblocktrans %}

View File

@ -0,0 +1,20 @@
{% extends "account/base.html" %}
{% load i18n %}
{% block head_title %}{% trans "Change Password" %}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-md-5">
<h1>{% trans "Change Password" %}</h1>
<form method="POST" action="" class="password_change">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" name="action">{% trans "Change Password" %}</button>
</form>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,14 @@
{% extends "account/base.html" %}
{% load i18n %}
{% block head_title %}{% trans "Delete Password" %}{% endblock %}
{% block content %}
<h1>{% trans "Delete Password" %}</h1>
<p>{% blocktrans %}You may delete your password since you are currently logged in using OpenID.{% endblocktrans %}</p>
<form method="post" action="">
{% csrf_token %}
<input type="submit" value="{% trans "delete my password" %}">
</form>
{% endblock %}

View File

@ -0,0 +1,10 @@
{% extends "account/base.html" %}
{% load i18n %}
{% block head_title %}{% trans "Password Deleted" %}{% endblock %}
{% block content %}
<h1>{% trans "Password Deleted" %}</h1>
<p>{% blocktrans %}Your password has been deleted.{% endblocktrans %}</p>
{% endblock %}

View File

@ -0,0 +1,37 @@
{% extends "account/base.html" %}
{% load i18n %}
{% load account %}
{% load crispy_forms_tags %}
{% block head_title %}{% trans "Password Reset" %}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-md-5">
<h1>{% trans "Password Reset" %}</h1>
{% if user.is_authenticated %}
{% include "account/snippets/already_logged_in.html" %}
{% endif %}
<p>{% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}</p>
<form method="POST" action="" class="password_reset">
{% csrf_token %}
{{ form|crispy }}
<button class="btn" type="submit">{% trans "Reset My Password" %}</button>
</form>
<p>{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}</p>
</div>
</div>
</div>
{% endblock %}
{% block extra_body %}
<script>
$("#id_email").focus();
</script>
{% endblock %}

View File

@ -0,0 +1,16 @@
{% extends "account/base.html" %}
{% load i18n %}
{% load account %}
{% block head_title %}{% trans "Password Reset" %}{% endblock %}
{% block content %}
<h1>{% trans "Password Reset" %}</h1>
{% if user.is_authenticated %}
{% include "account/snippets/already_logged_in.html" %}
{% endif %}
<p>{% blocktrans %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}</p>
{% endblock %}

View File

@ -0,0 +1,24 @@
{% extends "account/base.html" %}
{% load url from future %}
{% load i18n %}
{% block head_title %}{% trans "Change Password" %}{% endblock %}
{% block content %}
<h1>{% if token_fail %}{% trans "Bad Token" %}{% else %}{% trans "Change Password" %}{% endif %}</h1>
{% if token_fail %}
{% url 'account_reset_password' as passwd_reset_url %}
<p>{% blocktrans %}The password reset link was invalid, possibly because it has already been used. Please request a <a href="{{ passwd_reset_url }}">new password reset</a>.{% endblocktrans %}</p>
{% else %}
{% if form %}
<form method="POST" action="" class="uniForm">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" name="action" value="{% trans "change password" %}"/>
</form>
{% else %}
<p>{% trans 'Your password is now changed.' %}</p>
{% endif %}
{% endif %}
{% endblock %}

View File

@ -0,0 +1,16 @@
{% extends "account/base.html" %}
{% load url from future %}
{% load i18n %}
{% block head_title %}{% trans "Change Password" %}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-md-5">
<h2>{% trans "Change Password" %}</h2>
<p>{% trans 'Your password is now changed.' %}</p>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,21 @@
{% extends "account/base.html" %}
{% load i18n crispy_forms_tags %}
{% block head_title %}{% trans "Set Password" %}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-md-5">
<h2>{% trans "Set Password" %}</h2>
<form method="POST" action="" class="password_set">
{% csrf_token %}
{{ form|crispy }}
<input type="submit" name="action" value="{% trans "Set Password" %}"/>
</form>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,26 @@
{% extends "account/base.html" %}
{% load url from future %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block title %}{% trans "Signup" %}{% endblock title %}
{% block content %}
<h1>{% trans "Sign Up" %}</h1>
<p>{% blocktrans %}Already have an account? Then please <a href="{{ login_url }}">sign in</a>.{% endblocktrans %}</p>
<form class="signup" id="signup_form" method="post" action="{% url 'account_signup' %}">
{% csrf_token %}
{{ form|crispy }}
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}
<button class="btn" type="submit">{% trans "Sign Up" %} &raquo;</button>
</form>
{% endblock content %}

View File

@ -0,0 +1,20 @@
{% extends "account/base.html" %}
{% load url from future %}
{% load i18n %}
{% block head_title %}{% trans "Sign Up Closed" %}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-md-5">
<h2>{% trans "Sign Up Closed" %}</h2>
<p>{% trans "We are sorry, but the sign up is currently closed." %}</p>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,5 @@
{% load i18n %}
{% load account %}
{% user_display user as user_display %}
<p><strong>{% trans "Note" %}:</strong> {% blocktrans %}you are already logged in as {{ user_display }}.{% endblocktrans %}</p>

View File

@ -0,0 +1,18 @@
{% extends "account/base.html" %}
{% load i18n %}
{% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-md-5">
<h2>{% trans "Verify Your E-mail Address" %}</h2>
<p>{% blocktrans %}We have sent an e-mail to <a href="mailto:{{email}}">{{ email }}</a> for verification. Follow the link provided to finalize the signup process. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}</p>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,28 @@
{% extends "account/base.html" %}
{% load url from future %}
{% load i18n %}
{% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-md-5">
<h2>{% trans "Verify Your E-mail Address" %}</h2>
{% url 'account_email' as email_url %}
<p>{% blocktrans %}This part of the site requires us to verify that
you are who you claim to be. For this purpose, we require that you
verify ownership of your e-mail address. {% endblocktrans %}</p>
<p>{% blocktrans %}We have sent an e-mail to you for
verification. Please click on the link inside this e-mail. Please
contact us if you do not receive it within a few minutes.{% endblocktrans %}</p>
<p>{% blocktrans %}<strong>Note:</strong> you can still <a href="{{email_url}}">change your e-mail address</a>.{% endblocktrans %}</p>
</div>
</div>
</div>
{% endblock %}

View File

@ -32,12 +32,19 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</a> </a>
<a class="brand" href="#">{{ project_name }}</a> <a class="brand" href="{% url 'about '%}">{{ project_name }}</a>
<div class="nav-collapse collapse"> <div class="nav-collapse collapse">
<ul class="nav"> <ul class="nav">
<li class="active"><a href="#">Home</a></li> <li class="active"><a href="{% url 'about '%}">Home</a></li>
<li><a href="#about">About</a></li> <li><a href="{% url 'about '%}">About</a></li>
<li><a href="#contact">Contact</a></li>
{% if request.user.is_authenticated %}
<a href="{% url 'users:detail' request.user.username %}">{% trans "My Profile" %}</a>
<a href="{% url 'account_logout' %}">{% trans "Logout" %}</a>
{% else %}
<a href="{% url 'account_signup' %}">{% trans "Sign Up" %}</a> or
<a href="{% url 'account_login' %}">{% trans "Log In" %}</a>
{% endif %}
</ul> </ul>
</div><!--/.nav-collapse --> </div><!--/.nav-collapse -->
</div> </div>

View File

@ -0,0 +1 @@
{% extend "base.html" %}

View File

@ -0,0 +1 @@
{% extend "base.html" %}

View File

@ -0,0 +1,39 @@
{% extends "base.html" %}
{% load avatar_tags %}
{% load static %}
{% block title %}User: {{ object.username }}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-lg-3">
<h2>{{ object.username }}
</h2>
<p>{{ object.tagline }}</p>
{% if object == request.user %}
<!-- Action buttons -->
<div class="well">
<div class="row">
<div class="col-6">
<a class="btn btn-primary btn-block" href="{% url 'users:update' %}">My Info</a>
<a class="btn btn-primary btn-block" href="{% url 'account_email' %}">E-Mail</a>
</div>
<div class="col-6">
<a class="btn btn-info btn-block" href="">Avatar</a>
</div>
</div>
</div>
<!-- End Action buttons -->
{% endif %}
</div>
</div>
</div>
{% endblock content %}

View File

@ -0,0 +1,24 @@
{% extends "base.html" %}
{% load crispy_forms_tags %}
{% block title %}User: {{ user.username }}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1>{% block header %}User: {{ user.username }}{% endblock %}</h1>
<form class="form-horizontal" method="post" action="">
{% csrf_token %}
{{ form|crispy }}
<div class="control-group">
<div class="controls">
<button type="submit" class="btn">Update</button>
</div>
</div>
</form>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,34 @@
{% extends "base.html" %}
{% load static %}{% load i18n %}
{% load avatar_tags %}
{% block title %}Members{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-12">
<h2>Members</h2>
<p>Who loves cheese!</p>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="list-group">
{% for user in user_list %}
<a href="{% url 'users:detail' user.username %}" class="list-group-item">
<h4 class="list-group-item-heading">{% avatar user %} {{ user.username }}</h4>
<p class="list-group-item-text">{{ maker.tagline }}</p>
</a>
{% endfor %}
</div>
</div>
</div>
</div>
{% endblock content %}