mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-09 19:40:19 +00:00
Improve greatly the counter right management
This commit is contained in:
@ -11,7 +11,7 @@ class RegisteringForm(UserCreationForm):
|
||||
required_css_class = 'required'
|
||||
class Meta:
|
||||
model = User
|
||||
fields = ('first_name', 'last_name', 'email', 'date_of_birth')
|
||||
fields = ('first_name', 'last_name', 'email')
|
||||
|
||||
def save(self, commit=True):
|
||||
user = super(RegisteringForm, self).save(commit=False)
|
||||
@ -27,21 +27,12 @@ class UserPropForm(forms.ModelForm):
|
||||
required_css_class = 'required'
|
||||
class Meta:
|
||||
model = User
|
||||
fields = ['groups', 'edit_groups', 'view_groups']
|
||||
labels = {
|
||||
'edit_groups': "Edit profile group",
|
||||
'view_groups': "View profile group",
|
||||
}
|
||||
fields = ['groups']
|
||||
help_texts = {
|
||||
'edit_groups': "Groups that can edit this user's profile",
|
||||
'view_groups': "Groups that can view this user's profile",
|
||||
'groups': "Which groups this user belongs to",
|
||||
}
|
||||
widgets = {
|
||||
'groups': CheckboxSelectMultiple,
|
||||
'user_permissions': CheckboxSelectMultiple,
|
||||
'edit_groups': CheckboxSelectMultiple,
|
||||
'view_groups': CheckboxSelectMultiple,
|
||||
}
|
||||
|
||||
class PagePropForm(forms.ModelForm):
|
||||
|
@ -5,6 +5,8 @@ from django.core.urlresolvers import reverse
|
||||
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist
|
||||
from django.views.generic.edit import UpdateView
|
||||
from django.views.generic import ListView, DetailView, TemplateView
|
||||
from django.forms.models import modelform_factory
|
||||
from django.forms import CheckboxSelectMultiple
|
||||
import logging
|
||||
|
||||
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin
|
||||
@ -114,14 +116,15 @@ class UserUpdateProfileView(CanEditMixin, UpdateView):
|
||||
template_name = "core/user_edit.jinja"
|
||||
fields = ('first_name', 'last_name', 'nick_name', 'email', 'date_of_birth', )
|
||||
|
||||
class UserUpdatePropView(CanEditPropMixin, UpdateView):
|
||||
class UserUpdateGroupView(CanEditPropMixin, UpdateView):
|
||||
"""
|
||||
Edit a user's groups
|
||||
"""
|
||||
model = User
|
||||
pk_url_kwarg = "user_id"
|
||||
template_name = "core/user_prop.jinja"
|
||||
form_class = UserPropForm
|
||||
template_name = "core/user_group.jinja"
|
||||
form_class = modelform_factory(User, fields=['groups'],
|
||||
widgets={'groups':CheckboxSelectMultiple})
|
||||
context_object_name = "profile"
|
||||
|
||||
class UserToolsView(TemplateView):
|
||||
|
Reference in New Issue
Block a user