mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 18:44:23 +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>
|
<li><a href="{% url 'core:user_edit' profile.id %}">Edit</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if perms.core.change_prop_user %}
|
{% 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 %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ urlpatterns = [
|
|||||||
url(r'^user/$', UserListView.as_view(), name='user_list'),
|
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]+)/$', 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]+)/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'),
|
url(r'^user/tools/$', UserToolsView.as_view(), name='user_tools'),
|
||||||
|
|
||||||
# Page views
|
# Page views
|
||||||
|
@ -22,7 +22,7 @@ class RegisteringForm(UserCreationForm):
|
|||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
||||||
class UserGroupsForm(forms.ModelForm):
|
class UserPropForm(forms.ModelForm):
|
||||||
error_css_class = 'error'
|
error_css_class = 'error'
|
||||||
required_css_class = 'required'
|
required_css_class = 'required'
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -7,7 +7,7 @@ from django.views.generic import ListView, DetailView, TemplateView
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin
|
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
|
from core.models import User
|
||||||
|
|
||||||
def login(request):
|
def login(request):
|
||||||
@ -111,14 +111,14 @@ class UserUpdateProfileView(CanEditMixin, UpdateView):
|
|||||||
template_name = "core/user_edit.html"
|
template_name = "core/user_edit.html"
|
||||||
fields = ('first_name', 'last_name', 'nick_name', 'email', 'date_of_birth', )
|
fields = ('first_name', 'last_name', 'nick_name', 'email', 'date_of_birth', )
|
||||||
|
|
||||||
class UserUpdateGroupsView(CanEditPropMixin, UpdateView):
|
class UserUpdatePropView(CanEditPropMixin, UpdateView):
|
||||||
"""
|
"""
|
||||||
Edit a user's groups
|
Edit a user's groups
|
||||||
"""
|
"""
|
||||||
model = User
|
model = User
|
||||||
pk_url_kwarg = "user_id"
|
pk_url_kwarg = "user_id"
|
||||||
template_name = "core/user_groups.html"
|
template_name = "core/user_prop.html"
|
||||||
form_class = UserGroupsForm
|
form_class = UserPropForm
|
||||||
|
|
||||||
class UserToolsView(TemplateView):
|
class UserToolsView(TemplateView):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user