From 268a33255b2216369a1dde6f32440febf3f36fec Mon Sep 17 00:00:00 2001 From: Skia Date: Wed, 9 Dec 2015 11:01:11 +0100 Subject: [PATCH] Refactor user groups to user prop --- core/templates/core/user_detail.html | 2 +- core/templates/core/{user_groups.html => user_prop.html} | 0 core/urls.py | 2 +- core/views/forms.py | 2 +- core/views/user.py | 8 ++++---- 5 files changed, 7 insertions(+), 7 deletions(-) rename core/templates/core/{user_groups.html => user_prop.html} (100%) diff --git a/core/templates/core/user_detail.html b/core/templates/core/user_detail.html index d6b26578..2c87943e 100644 --- a/core/templates/core/user_detail.html +++ b/core/templates/core/user_detail.html @@ -16,7 +16,7 @@
  • Edit
  • {% endif %} {% if perms.core.change_prop_user %} -
  • Groups
  • +
  • Props
  • {% endif %} diff --git a/core/templates/core/user_groups.html b/core/templates/core/user_prop.html similarity index 100% rename from core/templates/core/user_groups.html rename to core/templates/core/user_prop.html diff --git a/core/urls.py b/core/urls.py index 4bea6ed8..5af32876 100644 --- a/core/urls.py +++ b/core/urls.py @@ -24,7 +24,7 @@ urlpatterns = [ url(r'^user/$', UserListView.as_view(), name='user_list'), url(r'^user/(?P[0-9]+)/$', UserView.as_view(), name='user_profile'), url(r'^user/(?P[0-9]+)/edit$', UserUpdateProfileView.as_view(), name='user_edit'), - url(r'^user/(?P[0-9]+)/groups$', UserUpdateGroupsView.as_view(), name='user_groups'), + url(r'^user/(?P[0-9]+)/prop$', UserUpdatePropView.as_view(), name='user_prop'), url(r'^user/tools/$', UserToolsView.as_view(), name='user_tools'), # Page views diff --git a/core/views/forms.py b/core/views/forms.py index 3f6397f8..aa6733b4 100644 --- a/core/views/forms.py +++ b/core/views/forms.py @@ -22,7 +22,7 @@ class RegisteringForm(UserCreationForm): return user -class UserGroupsForm(forms.ModelForm): +class UserPropForm(forms.ModelForm): error_css_class = 'error' required_css_class = 'required' class Meta: diff --git a/core/views/user.py b/core/views/user.py index fefed81d..e8b0f857 100644 --- a/core/views/user.py +++ b/core/views/user.py @@ -7,7 +7,7 @@ from django.views.generic import ListView, DetailView, TemplateView import logging from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin -from core.views.forms import RegisteringForm, UserGroupsForm +from core.views.forms import RegisteringForm, UserPropForm from core.models import User def login(request): @@ -111,14 +111,14 @@ class UserUpdateProfileView(CanEditMixin, UpdateView): template_name = "core/user_edit.html" fields = ('first_name', 'last_name', 'nick_name', 'email', 'date_of_birth', ) -class UserUpdateGroupsView(CanEditPropMixin, UpdateView): +class UserUpdatePropView(CanEditPropMixin, UpdateView): """ Edit a user's groups """ model = User pk_url_kwarg = "user_id" - template_name = "core/user_groups.html" - form_class = UserGroupsForm + template_name = "core/user_prop.html" + form_class = UserPropForm class UserToolsView(TemplateView): """