Commit e7fddf80 authored by xiaoyu's avatar xiaoyu

user-group-detail: add users support

parent f9b49605
......@@ -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 %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment