25
25
ContentLibraryCollectionComponentsUpdateSerializer ,
26
26
ContentLibraryCollectionUpdateSerializer ,
27
27
)
28
+ from openedx .core .types .http import RestRequest
28
29
29
30
30
31
class LibraryCollectionsView (ModelViewSet ):
@@ -89,23 +90,23 @@ def get_object(self) -> Collection:
89
90
return collection
90
91
91
92
@convert_exceptions
92
- def retrieve (self , request , * args , ** kwargs ) -> Response :
93
+ def retrieve (self , request : RestRequest , * args , ** kwargs ) -> Response :
93
94
"""
94
95
Retrieve the Content Library Collection
95
96
"""
96
97
# View declared so we can wrap it in @convert_exceptions
97
98
return super ().retrieve (request , * args , ** kwargs )
98
99
99
100
@convert_exceptions
100
- def list (self , request , * args , ** kwargs ) -> Response :
101
+ def list (self , request : RestRequest , * args , ** kwargs ) -> Response :
101
102
"""
102
103
List Collections that belong to Content Library
103
104
"""
104
105
# View declared so we can wrap it in @convert_exceptions
105
106
return super ().list (request , * args , ** kwargs )
106
107
107
108
@convert_exceptions
108
- def create (self , request , * args , ** kwargs ) -> Response :
109
+ def create (self , request : RestRequest , * args , ** kwargs ) -> Response :
109
110
"""
110
111
Create a Collection that belongs to a Content Library
111
112
"""
@@ -139,7 +140,7 @@ def create(self, request, *args, **kwargs) -> Response:
139
140
return Response (serializer .data )
140
141
141
142
@convert_exceptions
142
- def partial_update (self , request , * args , ** kwargs ) -> Response :
143
+ def partial_update (self , request : RestRequest , * args , ** kwargs ) -> Response :
143
144
"""
144
145
Update a Collection that belongs to a Content Library
145
146
"""
@@ -161,7 +162,7 @@ def partial_update(self, request, *args, **kwargs) -> Response:
161
162
return Response (serializer .data )
162
163
163
164
@convert_exceptions
164
- def destroy (self , request , * args , ** kwargs ) -> Response :
165
+ def destroy (self , request : RestRequest , * args , ** kwargs ) -> Response :
165
166
"""
166
167
Soft-deletes a Collection that belongs to a Content Library
167
168
"""
@@ -176,7 +177,7 @@ def destroy(self, request, *args, **kwargs) -> Response:
176
177
177
178
@convert_exceptions
178
179
@action (detail = True , methods = ['post' ], url_path = 'restore' , url_name = 'collection-restore' )
179
- def restore (self , request , * args , ** kwargs ) -> Response :
180
+ def restore (self , request : RestRequest , * args , ** kwargs ) -> Response :
180
181
"""
181
182
Restores a soft-deleted Collection that belongs to a Content Library
182
183
"""
@@ -191,7 +192,7 @@ def restore(self, request, *args, **kwargs) -> Response:
191
192
192
193
@convert_exceptions
193
194
@action (detail = True , methods = ['delete' , 'patch' ], url_path = 'components' , url_name = 'components-update' )
194
- def update_components (self , request , * args , ** kwargs ) -> Response :
195
+ def update_components (self , request : RestRequest , * args , ** kwargs ) -> Response :
195
196
"""
196
197
Adds (PATCH) or removes (DELETE) Components to/from a Collection.
197
198
@@ -209,7 +210,7 @@ def update_components(self, request, *args, **kwargs) -> Response:
209
210
content_library = content_library ,
210
211
collection_key = collection_key ,
211
212
usage_keys = usage_keys ,
212
- created_by = self . request .user .id ,
213
+ created_by = request .user .id ,
213
214
remove = (request .method == "DELETE" ),
214
215
)
215
216
0 commit comments