diff --git a/archilance/settings/base.py b/archilance/settings/base.py index 29ae6c6..b435cdf 100644 --- a/archilance/settings/base.py +++ b/archilance/settings/base.py @@ -312,7 +312,7 @@ SASS_PROCESSOR_ENABLED = DEBUG AUTH_USER_MODEL = 'users.User' ACCOUNT_ACTIVATION_DAYS = 7 REGISTRATION_AUTO_LOGIN = True -LOGIN_REDIRECT_URL = '/projects/' +LOGIN_REDIRECT_URL = '/users/dashboard_redirect/' LOGIN_URL = '/users/login/' PAGE_SIZE = 10 # Non-api page size (regular views) diff --git a/users/urls.py b/users/urls.py index 86f3061..4c6df3c 100755 --- a/users/urls.py +++ b/users/urls.py @@ -12,18 +12,19 @@ from .views import ( CreateTeamInvitation, CustomerProfileView, CustomerProfileCurrentProjectsView, - CustomerProfileOpenProjectsView, CustomerProfileReviewsView, CustomerProfileTrashedProjectsView, TeamCreateView, TeamProfileView, UserProfileEditViewFull, + dashboard_redirect ) app_name = 'users' urlpatterns = [ urls.url(r'^(?P\d+)/edit/$', UserProfileEditViewFull.as_view(), name='user-profile-edit'), + urls.url(r'^dashboard_redirect/$', dashboard_redirect, name='dashboard-redirect'), urls.url(r'^customers/(?P\d+)/$', CustomerProfileView.as_view(), name='customer-profile'), urls.url(r'^customers/(?P\d+)/trashed-projects/$', CustomerProfileTrashedProjectsView.as_view(), diff --git a/users/views.py b/users/views.py index a700c34..ffd3e69 100644 --- a/users/views.py +++ b/users/views.py @@ -105,6 +105,15 @@ from .forms import ( # context.update({'form': form}) # return render(request, self.template_name, context) +def dashboard_redirect(request): + """ + Перенаправляем в личный кабинет пользователя + :param request: + :return: + """ + redirect_to = '/users/{}/{}'.format('customers' if request.user.is_customer() else 'contractors', request.user.id) + return redirect(redirect_to) + class UserProfileEditViewFull(BaseMixin, View): form_class = UserProfileEditFullForm