diff --git a/accounts/views.py b/accounts/views.py index b11900c9..77765f08 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -244,7 +244,7 @@ class BaseProfileView(ProfileInvalidView): def form_valid(self, form): profile = self.request.user.profile form = self.form_class(self.request.POST, instance=profile) - form.save() + profile = form.save() response = {'success': True, 'rating': profile.user.rating} return HttpResponse(json.dumps(response), content_type='application/json') @@ -276,7 +276,7 @@ class AvatarView(BaseProfileView): def form_valid(self, form): profile = self.request.user.profile form = self.form_class(self.request.POST, self.request.FILES, instance=profile) - form.save() + profile = form.save() if self.request.is_ajax(): im = get_thumbnail(profile.avatar, '100x100', crop='center') response = {'success': True, 'url': im.url, 'rating': profile.user.rating} @@ -335,7 +335,7 @@ class NameView(ProfileInvalidView): def form_valid(self, form): user = self.request.user form = self.form_class(self.request.POST, instance=user) - form.save() + user = form.save() response = {'success': True, 'rating': user.rating} return HttpResponse(json.dumps(response), content_type='application/json') diff --git a/company/edit_views.py b/company/edit_views.py index 89f7e77e..11e8b775 100644 --- a/company/edit_views.py +++ b/company/edit_views.py @@ -24,7 +24,7 @@ class BaseView(ProfileInvalidView): else: form = self.form_class(self.request.POST, instance=company) - form.save() + company = form.save() response = {'success': True, 'rating': company.rating} return HttpResponse(json.dumps(response), content_type='application/json') @@ -47,7 +47,7 @@ class LogoView(BaseView): if company.creator_id != self.request.user.id: return HttpResponseForbidden() form = self.form_class(self.request.POST, self.request.FILES, instance=company) - form.save() + company = form.save() if self.request.is_ajax(): im = get_thumbnail(company.logo, '100x100', crop='center') response = {'success': True, 'url': im.url, 'rating': company.rating} diff --git a/registration/backends/default/views.py b/registration/backends/default/views.py index c267363a..7a170bbd 100644 --- a/registration/backends/default/views.py +++ b/registration/backends/default/views.py @@ -199,7 +199,7 @@ def LogoutView(request): def LoginView(request): if request.POST: - form = AuthenticationForm(data=request.POST) + form = LoginForm(data=request.POST) #return HttpResponse(form.username) diff --git a/registration/forms.py b/registration/forms.py index 79a25c9e..59c3cd3b 100644 --- a/registration/forms.py +++ b/registration/forms.py @@ -127,6 +127,28 @@ class RegistrationFormNoFreeEmail(RegistrationForm): raise forms.ValidationError(_("Registration using free email addresses is prohibited. Please supply a different email address.")) return self.cleaned_data['email'] + +from django.contrib.auth import authenticate class LoginForm(AuthenticationForm): - username = forms.CharField(max_length=254, widget=forms.TextInput(attrs={'placeholder': _(u'Ваш адрес электронной почты')})) - password = forms.CharField(label=_("Password"), widget=forms.PasswordInput(attrs={'placeholder': _(u'Ваш Пароль')})) \ No newline at end of file + def clean(self): + username = self.cleaned_data.get('username') + password = self.cleaned_data.get('password') + + if username and password: + self.user_cache = authenticate(username=username, + password=password) + if self.user_cache is None: + data = self.cleaned_data + self._errors['password'] = ErrorList([self.error_messages['invalid_login'] % { + 'username': self.username_field.verbose_name + }]) + del data['password'] + + return data + + elif not self.user_cache.is_active: + raise forms.ValidationError(self.error_messages['inactive']) + self.check_for_test_cookie() + return self.cleaned_data + + diff --git a/templates/client/includes/accounts/current_user.html b/templates/client/includes/accounts/current_user.html index 8a1ab031..e1587a74 100644 --- a/templates/client/includes/accounts/current_user.html +++ b/templates/client/includes/accounts/current_user.html @@ -56,10 +56,10 @@ -
551
+
{{ user.rating }}
-

{% trans 'Заполните свой профиль, чтобы повысить рейтинг' %}

-

{% trans 'Чем выше рейтинг — тем больше преимуществ!' %}

+

Заполните свой
профиль, чтобы
повысить рейтинг

+

Чем выше
рейтинг —
тем больше
преимуществ!

{# END avatar #} @@ -550,10 +550,7 @@ addCompany:{ modalId:'pw-company', formId:'create_company_form' - }, - rating:{ - id:'profile-rating' - } + } }); diff --git a/templates/client/includes/company/company_edit.html b/templates/client/includes/company/company_edit.html index a86f374a..2f16b6d9 100644 --- a/templates/client/includes/company/company_edit.html +++ b/templates/client/includes/company/company_edit.html @@ -58,7 +58,7 @@ -
551
+
{{ company.rating }}
@@ -625,10 +625,10 @@ // some helper text in current language lang:{ workIn:'в'// there must be 'at' in English - }, - rating:{ - id:'profile-rating' } + + + }); {% endblock %} diff --git a/templates/client/organiser/add_event.html b/templates/client/organiser/add_event.html index e1715f60..9fcc4ceb 100644 --- a/templates/client/organiser/add_event.html +++ b/templates/client/organiser/add_event.html @@ -16,6 +16,7 @@ {% endblock %} {% block page_body %} +
@@ -779,6 +780,298 @@
+======= +
+
+
+

{% trans 'Шаг 1. Основная информация' %}

+
+
+ +
+ +
+ +
+ + + + +
+
+ +
+ +
+ +
+
+ + {{ form.theme }} +
+ +
+
+
+
+ +
    + + {% for val, choice in form.theme.field.choices %} +
  • + {% endfor %} +
+
+
+
+ +
+
+ +
+ +
+
+
+
+
+
    + +
+
+
+
+ +
+
+
+ +
+ +

{% trans 'Описание выставки' %}

+ +
+
+ {{ form.name }} +
+
+ +
+
+ {{ form.main_title }} +
+
+ +
+
+ +
+
+ +
+ +
+ +
+
+
+ + +
+
+ + +
+
+
+
+ +
+ +
+ +

{% trans 'Локация' %}

+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+

{% trans 'Дополнительная информация' %}

+ +
+ +
+ +
+
+ + + +
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+ + + + + + + +
+ +
+
+ +
+
+ + + + + +
+ +
+
+ +
+ +
+
+
+ +
+ +
+ + +
+ +
+ + +
+ + +
+ +
+
+ +
+ +
+ + + +
+ +
+ + + + + +
+
+ +
+
+

{% trans 'Шаг 2. Добавление фото' %}

+
+
+ +
+
+

{% trans 'Шаг 3. Статистика и условия участия' %}

+
+
+