Pārlūkot izejas kodu

HUE-628 Added user group selection on creating/editing user

Enrico Berti 13 gadi atpakaļ
vecāks
revīzija
a63b556cef

+ 5 - 0
apps/useradmin/src/useradmin/templates/edit_user.mako

@@ -36,4 +36,9 @@ ${commonheader_iframe()}
 	% endfor
     </fieldset>
 </form>
+<script type="text/javascript" charset="utf-8">
+	$(document).ready(function(){
+		$("#id_groups").jHueSelector();
+	});
+</script>
 ${commonfooter_iframe()}

+ 3 - 1
apps/useradmin/src/useradmin/templates/list_users.mako

@@ -41,17 +41,19 @@ ${layout.menubar(section='users')}
             <th>${_('First Name')}</th>
             <th>${_('Last Name')}</th>
             <th>${_('E-mail')}</th>
+			<th>${_('Groups')}</th>
             <th>${_('Last Login')}</th>
 			<th>&nbsp;</th>
           </tr>
         </head>
         <tbody>
         % for listed_user in users:
-          <tr class="userRow" data-search="${listed_user.username}${listed_user.first_name}${listed_user.last_name}${listed_user.email}">
+          <tr class="userRow" data-search="${listed_user.username}${listed_user.first_name}${listed_user.last_name}${listed_user.email}${', '.join([group.name for group in listed_user.groups.all()])}">
             <td>${listed_user.username}</td>
             <td>${listed_user.first_name}</td>
             <td>${listed_user.last_name}</td>
             <td>${listed_user.email}</td>
+			<td>${', '.join([group.name for group in listed_user.groups.all()])}</td>
             <td>
               ${listed_user.last_login.strftime('%c')}
             </td>

+ 1 - 1
apps/useradmin/src/useradmin/views.py

@@ -109,7 +109,7 @@ class UserChangeForm(django.contrib.auth.forms.UserChangeForm):
   password2 = forms.CharField(label="Password confirmation", widget=forms.PasswordInput, required=False)
 
   class Meta(django.contrib.auth.forms.UserChangeForm.Meta):
-    fields = ["username", "first_name", "last_name", "email", "is_active", "is_superuser"]
+    fields = ["username", "first_name", "last_name", "email", "is_active", "is_superuser", "groups"]
 
   def clean_password2(self):
     password1 = self.cleaned_data.get("password1", "")