user-group-detail: add users support

pull/530/head
xiaoyu 8 years ago
parent f9b49605e4
commit e7fddf80ae

@ -92,6 +92,16 @@ class GroupEditApi(generics.RetrieveUpdateDestroyAPIView):
queryset = UserGroup.objects.all()
serializer_class = GroupEditSerializer
def perform_update(self, serializer):
partial = serializer.validated_data.get('partial', False)
users = serializer.validated_data.get('users')
if partial and users:
group = self.get_object()
group.users.add(users)
group.save()
return
return super(GroupEditApi, self).perform_update(serializer)
class UserBulkUpdateApi(ListBulkCreateUpdateDestroyAPIView):
queryset = User.objects.all()

@ -184,6 +184,8 @@ $(document).on('click', '.btn_remove', function(){
};
console.log(body);
$('#select_user_modal').modal('hide');
var the_url = "{% url 'users:user-group-edit-api' pk=object.id %}";
APIUpdateAttr({url: the_url, body: JSON.stringify(body)});
})
</script>
{% endblock %}

Loading…
Cancel
Save