From 98edf72ec5eaf9aeaa91dfc8a046fbcd7442e272 Mon Sep 17 00:00:00 2001 From: Anastasia Date: Sun, 7 Jun 2015 16:00:46 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B0=D0=B2=D1=82=D0=BE=D1=80=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- asuzr/views.py | 7 ++- record/urls.py | 3 + templates/registration/logged_out.html | 12 ++++ templates/registration/login.html | 56 +++++++++++++++++++ .../registration/password_change_done.html | 19 +++++++ .../registration/password_change_form.html | 55 ++++++++++++++++++ .../registration/password_reset_complete.html | 21 +++++++ .../registration/password_reset_confirm.html | 37 ++++++++++++ .../registration/password_reset_done.html | 21 +++++++ .../registration/password_reset_email.html | 14 +++++ .../registration/password_reset_form.html | 24 ++++++++ 11 files changed, 267 insertions(+), 2 deletions(-) create mode 100644 templates/registration/logged_out.html create mode 100644 templates/registration/login.html create mode 100644 templates/registration/password_change_done.html create mode 100644 templates/registration/password_change_form.html create mode 100644 templates/registration/password_reset_complete.html create mode 100644 templates/registration/password_reset_confirm.html create mode 100644 templates/registration/password_reset_done.html create mode 100644 templates/registration/password_reset_email.html create mode 100644 templates/registration/password_reset_form.html diff --git a/asuzr/views.py b/asuzr/views.py index 42c7b77..8de6fe2 100644 --- a/asuzr/views.py +++ b/asuzr/views.py @@ -12,6 +12,7 @@ from django.db.models import Count, Sum from asuzr.common import custom_date from django.contrib.auth.decorators import login_required +@login_required def prod_list(request): product_list = Product.objects.all() t = loader.get_template('asuzr/prod_list.html') @@ -20,10 +21,10 @@ def prod_list(request): }) return HttpResponse(t.render(c)) +@login_required def prod_detail(request, prod_id): return HttpResponse("This is %s" % prod_id) - def get_filtered_list(p_list, year, month): filtered_list=[] for a in p_list: @@ -37,7 +38,7 @@ def get_orders_by_date(dt): order_list = Order.objects.filter(date=dt).order_by('id') return order_list - +@login_required def main(request, day, month, year): d,m,y=int(day),int(month), int(year) @@ -119,6 +120,7 @@ def orders (request, archive): }) return HttpResponse(t.render(c)) +@login_required def desreport(request): start_date = request.GET.get('sdate', date.today().strftime('%d.%m.%y')) sdate = datetime.strptime(start_date, '%d.%m.%y') @@ -133,6 +135,7 @@ def desreport(request): }) return HttpResponse(t.render(c)) +@login_required def production_table(request, order_id): order_list = Order.objects.filter(is_done=False).order_by('-id') sel_order = Order.objects.filter(id=order_id) diff --git a/record/urls.py b/record/urls.py index b60010f..9a97213 100644 --- a/record/urls.py +++ b/record/urls.py @@ -1,4 +1,5 @@ from django.conf.urls import patterns, include, url +from django.contrib.auth.views import login, logout from django.contrib import admin admin.autodiscover() @@ -15,4 +16,6 @@ urlpatterns = patterns('', url(r'^production_table/(?P\d+)/$', 'asuzr.views.production_table'), url(r'^admin/', include(admin.site.urls)), url(r'^inplaceeditform/', include('inplaceeditform.urls')), + url(r'^accounts/login/$', login), + url(r'^accounts/logout/$', logout), ) diff --git a/templates/registration/logged_out.html b/templates/registration/logged_out.html new file mode 100644 index 0000000..6a18186 --- /dev/null +++ b/templates/registration/logged_out.html @@ -0,0 +1,12 @@ +{% extends "admin/base_site.html" %} +{% load i18n %} + +{% block breadcrumbs %}{% endblock %} + +{% block content %} + +

{% trans "Thanks for spending some quality time with the Web site today." %}

+ +

{% trans 'Log in again' %}

+ +{% endblock %} diff --git a/templates/registration/login.html b/templates/registration/login.html new file mode 100644 index 0000000..1371514 --- /dev/null +++ b/templates/registration/login.html @@ -0,0 +1,56 @@ +{% extends "admin/base_site.html" %} +{% load i18n admin_static %} + +{% block extrastyle %}{{ block.super }}{% endblock %} + +{% block bodyclass %}login{% endblock %} + +{% block nav-global %}{% endblock %} + +{% block content_title %}{% endblock %} + +{% block breadcrumbs %}{% endblock %} + +{% block content %} +{% if form.errors and not form.non_field_errors and not form.this_is_the_login_form.errors %} +

+{% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} +

+{% endif %} + +{% if form.non_field_errors or form.this_is_the_login_form.errors %} +{% for error in form.non_field_errors|add:form.this_is_the_login_form.errors %} +

+ {{ error }} +

+{% endfor %} +{% endif %} + +
+
{% csrf_token %} +
+ {% if not form.this_is_the_login_form.errors %}{{ form.username.errors }}{% endif %} + {{ form.username }} +
+
+ {% if not form.this_is_the_login_form.errors %}{{ form.password.errors }}{% endif %} + {{ form.password }} + + +
+ {% url 'admin_password_reset' as password_reset_url %} + {% if password_reset_url %} + + {% endif %} +
+ +
+
+ + +
+{% endblock %} diff --git a/templates/registration/password_change_done.html b/templates/registration/password_change_done.html new file mode 100644 index 0000000..1c928a0 --- /dev/null +++ b/templates/registration/password_change_done.html @@ -0,0 +1,19 @@ +{% extends "admin/base_site.html" %} +{% load i18n %} +{% block userlinks %}{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}{% trans 'Documentation' %} / {% endif %}{% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %} +{% block breadcrumbs %} + +{% endblock %} + +{% block title %}{% trans 'Password change successful' %}{% endblock %} + +{% block content %} + +

{% trans 'Password change successful' %}

+ +

{% trans 'Your password was changed.' %}

+ +{% endblock %} diff --git a/templates/registration/password_change_form.html b/templates/registration/password_change_form.html new file mode 100644 index 0000000..f7316a7 --- /dev/null +++ b/templates/registration/password_change_form.html @@ -0,0 +1,55 @@ +{% extends "admin/base_site.html" %} +{% load i18n static %} +{% block extrastyle %}{{ block.super }}{% endblock %} +{% block userlinks %}{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}{% trans 'Documentation' %} / {% endif %} {% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %} +{% block breadcrumbs %} + +{% endblock %} + +{% block title %}{% trans 'Password change' %}{% endblock %} + +{% block content %}
+ +
{% csrf_token %} +
+{% if form.errors %} +

+ {% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} +

+{% endif %} + +

{% trans 'Password change' %}

+ +

{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}

+ +
+ +
+ {{ form.old_password.errors }} + {{ form.old_password }} +
+ +
+ {{ form.new_password1.errors }} + {{ form.new_password1 }} +
+ +
+{{ form.new_password2.errors }} + {{ form.new_password2 }} +
+ +
+ +
+ +
+ + +
+
+ +{% endblock %} diff --git a/templates/registration/password_reset_complete.html b/templates/registration/password_reset_complete.html new file mode 100644 index 0000000..d97f338 --- /dev/null +++ b/templates/registration/password_reset_complete.html @@ -0,0 +1,21 @@ +{% extends "admin/base_site.html" %} +{% load i18n %} + +{% block breadcrumbs %} + +{% endblock %} + +{% block title %}{% trans 'Password reset complete' %}{% endblock %} + +{% block content %} + +

{% trans 'Password reset complete' %}

+ +

{% trans "Your password has been set. You may go ahead and log in now." %}

+ +

{% trans 'Log in' %}

+ +{% endblock %} diff --git a/templates/registration/password_reset_confirm.html b/templates/registration/password_reset_confirm.html new file mode 100644 index 0000000..81020b9 --- /dev/null +++ b/templates/registration/password_reset_confirm.html @@ -0,0 +1,37 @@ +{% extends "admin/base_site.html" %} +{% load i18n %} + +{% block breadcrumbs %} + +{% endblock %} + +{% block title %}{% trans 'Password reset' %}{% endblock %} + +{% block content %} + +{% if validlink %} + +

{% trans 'Enter new password' %}

+ +

{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}

+ +
{% csrf_token %} +{{ form.new_password1.errors }} +

{{ form.new_password1 }}

+{{ form.new_password2.errors }} +

{{ form.new_password2 }}

+

+
+ +{% else %} + +

{% trans 'Password reset unsuccessful' %}

+ +

{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}

+ +{% endif %} + +{% endblock %} diff --git a/templates/registration/password_reset_done.html b/templates/registration/password_reset_done.html new file mode 100644 index 0000000..9847104 --- /dev/null +++ b/templates/registration/password_reset_done.html @@ -0,0 +1,21 @@ +{% extends "admin/base_site.html" %} +{% load i18n %} + +{% block breadcrumbs %} + +{% endblock %} + +{% block title %}{% trans 'Password reset successful' %}{% endblock %} + +{% block content %} + +

{% trans 'Password reset successful' %}

+ +

{% trans "We've emailed you instructions for setting your password. You should be receiving them shortly." %}

+ +

{% trans "If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder." %}

+ +{% endblock %} diff --git a/templates/registration/password_reset_email.html b/templates/registration/password_reset_email.html new file mode 100644 index 0000000..01b3bcc --- /dev/null +++ b/templates/registration/password_reset_email.html @@ -0,0 +1,14 @@ +{% load i18n %}{% autoescape off %} +{% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %} + +{% trans "Please go to the following page and choose a new password:" %} +{% block reset_link %} +{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %} +{% endblock %} +{% trans "Your username, in case you've forgotten:" %} {{ user.get_username }} + +{% trans "Thanks for using our site!" %} + +{% blocktrans %}The {{ site_name }} team{% endblocktrans %} + +{% endautoescape %} diff --git a/templates/registration/password_reset_form.html b/templates/registration/password_reset_form.html new file mode 100644 index 0000000..c9998a1 --- /dev/null +++ b/templates/registration/password_reset_form.html @@ -0,0 +1,24 @@ +{% extends "admin/base_site.html" %} +{% load i18n %} + +{% block breadcrumbs %} + +{% endblock %} + +{% block title %}{% trans "Password reset" %}{% endblock %} + +{% block content %} + +

{% trans "Password reset" %}

+ +

{% trans "Forgotten your password? Enter your email address below, and we'll email instructions for setting a new one." %}

+ +
{% csrf_token %} +{{ form.email.errors }} +

{{ form.email }}

+
+ +{% endblock %}