From ef1d2b4bc5c6b6f361637549c5ad66b2b5b38957 Mon Sep 17 00:00:00 2001 From: Mukhtar Date: Mon, 15 Aug 2016 12:57:23 +0300 Subject: [PATCH] #ARC-2 add links for password-reset --- archilance/urls.py | 34 ++--- templates/partials/header.html | 6 + templates/password_reset/recovery_done.html | 25 ++-- templates/password_reset/recovery_email.txt | 2 +- templates/password_reset/recovery_form.html | 46 ++++--- templates/password_reset/reset.html | 91 +++++++------ templates/password_reset/reset_sent.html | 33 ++--- templates/registration/login.html | 8 ++ templates/registration/logout.html | 14 +- users/urls.py | 2 +- work_sell/forms.py | 6 + work_sell/templates/worksells_list.html | 135 +++++++++++++------- work_sell/views.py | 9 ++ 13 files changed, 253 insertions(+), 158 deletions(-) diff --git a/archilance/urls.py b/archilance/urls.py index a7990f2..b4886e8 100644 --- a/archilance/urls.py +++ b/archilance/urls.py @@ -7,25 +7,25 @@ from django.views.generic import TemplateView from .views import HomeTemplateView, TestChatTemplateView - urlpatterns = [ - url(r'^$', HomeTemplateView.as_view()), - url('', include('social.apps.django_app.urls', namespace='social')), - url(r'^chattest/$', TestChatTemplateView.as_view()), - url(r'^work_sell/', include('work_sell.urls')), - url(r'^test/$', TemplateView.as_view(template_name='test.html'), name='test'), - url(r'^projects/', include('projects.urls')), - url(r'^reviews/', include('reviews.urls')), - url(r'^wallets/', include('wallets.urls')), - url(r'^chat/', include('chat.urls')), - url(r'^specializations/', include('specializations.urls')), - url(r'^users/', include('users.urls')), - url(r'^common/', include('common.urls')), - url(r'^users/', include('registration.backends.default.urls')), + url(r'^$', HomeTemplateView.as_view()), + url('', include('social.apps.django_app.urls', namespace='social')), + url(r'^chattest/$', TestChatTemplateView.as_view()), + url(r'^work_sell/', include('work_sell.urls')), + url(r'^test/$', TemplateView.as_view(template_name='test.html'), name='test'), + url(r'^projects/', include('projects.urls')), + url(r'^reviews/', include('reviews.urls')), + url(r'^wallets/', include('wallets.urls')), + url(r'^chat/', include('chat.urls')), + url(r'^specializations/', include('specializations.urls')), + url(r'^users/', include('users.urls')), + url(r'^common/', include('common.urls')), + url(r'^password/', include('password_reset.urls')), + url(r'^users/', include('registration.backends.default.urls')), - url(r'^admin/', admin.site.urls), - url(r'^api/', include('api.urls')), -] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + url(r'^admin/', admin.site.urls), + url(r'^api/', include('api.urls')), + ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) if settings.DEBUG: urlpatterns += staticfiles_urlpatterns() diff --git a/templates/partials/header.html b/templates/partials/header.html index 351f2aa..d125373 100644 --- a/templates/partials/header.html +++ b/templates/partials/header.html @@ -108,9 +108,15 @@
  • Настройки
  • +
  • FAQ
  • + +
  • + Выйти +
  • + diff --git a/templates/password_reset/recovery_done.html b/templates/password_reset/recovery_done.html index 6d79be5..24b27e4 100644 --- a/templates/password_reset/recovery_done.html +++ b/templates/password_reset/recovery_done.html @@ -3,18 +3,21 @@ {% block title %}{% trans "New password set" %}{% endblock %} {% block content %} + {% include 'partials/header.html' %} +
    +
    +
    +

    Успех

    +
    -
    -
    -
    +
    + {% trans "Your password has successfully been reset. You can use it right now on the login page." %} +
    - -
    + {% include 'partials/footer.html' %} +
    +
    -
    -
    Успех
    - {% trans "Your password has successfully been reset. You can use it right now on the login page." %} -
    -
    - {% endblock %} + + diff --git a/templates/password_reset/recovery_email.txt b/templates/password_reset/recovery_email.txt index f7a509c..9c4af9c 100644 --- a/templates/password_reset/recovery_email.txt +++ b/templates/password_reset/recovery_email.txt @@ -4,6 +4,6 @@ {% trans "You can set your new password by following this link:" %} -http{% if secure %}s{% endif %}://{{ site.domain }} +http{% if secure %}s{% endif %}://{{ site.domain }}{% url "password_reset_reset" token %} {% trans "If you don't want to reset your password, simply ignore this email and it will stay unchanged." %} diff --git a/templates/password_reset/recovery_form.html b/templates/password_reset/recovery_form.html index 927426c..3481963 100644 --- a/templates/password_reset/recovery_form.html +++ b/templates/password_reset/recovery_form.html @@ -5,25 +5,37 @@ {% block content %} {% include 'partials/header.html' %} +
    +
    -
    -

    Восстановление пароля

    -
    -
    -
    - {% csrf_token %} - -
    - -

    {{ form.username_or_email.errors.as_text }}

    -
    +
    +

    Восстановление пароля

    +
    + +
    + + {% csrf_token %} -
    - +
    + +

    {{ form.username_or_email.errors.as_text }}

    +
    + +
    + +
    + +
    +

    +
    +
    + + {% include 'partials/footer.html' %}
    -
    + {% endblock %} diff --git a/templates/password_reset/reset.html b/templates/password_reset/reset.html index c0322b8..9605571 100644 --- a/templates/password_reset/reset.html +++ b/templates/password_reset/reset.html @@ -1,46 +1,55 @@ {% extends "password_reset/base.html" %}{% load i18n %} {% block content %} -
    -
    -
    - - -
    - -
    -
    Сброс пароля
    - - {% if invalid %}{% url "password_reset_recover" as recovery_url %} - {% blocktrans %}Sorry, this password reset link is invalid. You can still - request a new one.{% endblocktrans %} - {% else %} - - {% blocktrans %}Hi, {{ username }}. Please choose your new password.{% endblocktrans %} - - -
    - {% csrf_token %} - -
    - -

    {{ form.password1.errors.as_text }}

    -
    -
    - -

    {{ form.password2.errors.as_text }}

    -
    - -
    - -
    -
    - {% endif %} + {% include 'partials/header.html' %} +
    +
    +
    +

    Сброс пароля

    +
    + + + {% if invalid %}{% url "password_reset_recover" as recovery_url %} +
    + {% blocktrans %}Sorry, this password reset link is invalid. You can still + request a new one.{% endblocktrans %} +
    + {% else %} + + + + +
    + {% blocktrans %}Hi, {{ username }}. Please choose your new password. + {% endblocktrans %} +
    + {% csrf_token %} + +
    + +

    {{ form.password1.errors.as_text }}

    +
    + +
    + +

    {{ form.password2.errors.as_text }}

    +
    + +
    + +
    +
    +
    + {% endif %} + + {% include 'partials/footer.html' %} +
    -
    - + {% endblock %} diff --git a/templates/password_reset/reset_sent.html b/templates/password_reset/reset_sent.html index 8f240c1..0c54871 100644 --- a/templates/password_reset/reset_sent.html +++ b/templates/password_reset/reset_sent.html @@ -3,26 +3,21 @@ {% block title %}{% trans "Password recovery sent" %}{% endblock %} -{#{% block content %}#} -{#

    #} -{#{% endblock %}#} - - {% block content %} + {% include 'partials/header.html' %} +
    +
    +
    +

    Письмо отправлено

    +
    +
    + {% blocktrans with ago=timestamp|timesince %}An email was sent to {{ email }} + {{ ago }} ago. Use the link in it to set a new password.{% endblocktrans %} +
    -
    -
    -
    + {% include 'partials/footer.html' %} +
    +
    - -
    - -
    -
    Письмо отправлено
    -{#
    #} - {% blocktrans with ago=timestamp|timesince %}An email was sent to {{ email }} {{ ago }} ago. Use the link in it to set a new password.{% endblocktrans %} -
    -{#
    #} -
    - {% endblock %} + diff --git a/templates/registration/login.html b/templates/registration/login.html index b155cc5..473f966 100644 --- a/templates/registration/login.html +++ b/templates/registration/login.html @@ -17,6 +17,14 @@
    +
    +
    + +

    Запомнить

    +

    Забыли пароль ?

    +
    +
    +
    diff --git a/templates/registration/logout.html b/templates/registration/logout.html index 7899492..dfd0c93 100644 --- a/templates/registration/logout.html +++ b/templates/registration/logout.html @@ -1,7 +1,15 @@ {% extends 'partials/base.html' %} {% block content %} -
    -

    Выход

    -
    + {% include 'partials/header.html' %} +
    +
    +
    +

    Вы вышли

    +
    + + {% include 'partials/footer.html' %} +
    +
    + {% endblock %} diff --git a/users/urls.py b/users/urls.py index e6c49c1..e65d542 100755 --- a/users/urls.py +++ b/users/urls.py @@ -23,7 +23,7 @@ from .views import ( app_name = 'users' urlpatterns = [ - urls.url(r'^password/', include('password_reset.urls')), + urls.url(r'^(?P\d+)/edit/$', UserProfileEditView.as_view(), name='user-profile-edit'), urls.url(r'^(?P\d+)/financial-info/edit/$', UserFinancialInfoEditView.as_view(), name='user-financial-info-edit'), diff --git a/work_sell/forms.py b/work_sell/forms.py index 40887ca..f14f6fb 100644 --- a/work_sell/forms.py +++ b/work_sell/forms.py @@ -44,3 +44,9 @@ class WorkSellForm(forms.ModelForm): self.fields['location'].queryset = Location.objects.root_nodes()[0].get_descendants() # self.fields['location'].queryset = Location.objects # Migrate with this enabled + + +# class WorkSellFilterForm(forms.ModelForm): +# +# class Meta: +# model = WorkSell diff --git a/work_sell/templates/worksells_list.html b/work_sell/templates/worksells_list.html index 47e7d70..837a886 100644 --- a/work_sell/templates/worksells_list.html +++ b/work_sell/templates/worksells_list.html @@ -13,56 +13,68 @@
    -
    +
    + +
    -
    Специализации:
    -
    -
    -
    +
    Тип работы
    - + {{ form.work_type }}
    +
    + + +
    +
    Специализации
    +
    +
    +
    - +
    - +
    - +
    - -
    -
    -
    Тип работ:
    -
    +
    + +
    + +
    -
    -
    - - - + + + + + +

    Расширенный поиск

    @@ -74,43 +86,70 @@
    + + + + + + + + +
    -
    Классификация
    -
    Вид строительства:
    -
    Местоположение:
    +
    Классификация здания
    +
    Вид строительства
    -
    + +
    - + {{ realty_form.building_classification }}
    +
    - + {{ realty_form.construction_type }}
    +
    +
    + + + + + +
    +
    +
    Местоположение
    +
    + +
    +
    + +
    +
    - +
    +
    - + +
    + + +
    + +
    +
    + +

    Требуется допуск (СРО)

    - + + +
    diff --git a/work_sell/views.py b/work_sell/views.py index 0a2fe24..a760489 100644 --- a/work_sell/views.py +++ b/work_sell/views.py @@ -63,6 +63,15 @@ class WorkSellsView(ListView): return context +class WorkSellFilterView(View): + template_name = 'worksells_list.html' + + def get(self, request, *args, **kwargs): + context = {} + return render(request, self.template_name, context) + + + class WorkSellDetail(DetailView): model = WorkSell template_name = 'worksell_detail.html'