mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 06:03:20 +00:00
Refactor user groups to user prop
This commit is contained in:
parent
77803596fb
commit
268a33255b
@ -16,7 +16,7 @@
|
||||
<li><a href="{% url 'core:user_edit' profile.id %}">Edit</a></li>
|
||||
{% endif %}
|
||||
{% if perms.core.change_prop_user %}
|
||||
<li><a href="{% url 'core:user_groups' profile.id %}">Groups</a></li>
|
||||
<li><a href="{% url 'core:user_prop' profile.id %}">Props</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
|
@ -24,7 +24,7 @@ urlpatterns = [
|
||||
url(r'^user/$', UserListView.as_view(), name='user_list'),
|
||||
url(r'^user/(?P<user_id>[0-9]+)/$', UserView.as_view(), name='user_profile'),
|
||||
url(r'^user/(?P<user_id>[0-9]+)/edit$', UserUpdateProfileView.as_view(), name='user_edit'),
|
||||
url(r'^user/(?P<user_id>[0-9]+)/groups$', UserUpdateGroupsView.as_view(), name='user_groups'),
|
||||
url(r'^user/(?P<user_id>[0-9]+)/prop$', UserUpdatePropView.as_view(), name='user_prop'),
|
||||
url(r'^user/tools/$', UserToolsView.as_view(), name='user_tools'),
|
||||
|
||||
# Page views
|
||||
|
@ -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:
|
||||
|
@ -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):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user