Code Duplication    Length = 17-17 lines in 2 locations

django_th/views_userservices.py 1 location

@@ 137-153 (lines=17) @@
134
135
136
class UserServiceMixin(object):
137
    """
138
        Mixin for UpdateView and DeleteView
139
    """
140
    queryset = UserService.objects.all()
141
142
    @method_decorator(login_required)
143
    def dispatch(self, *args, **kwargs):
144
        return super(UserServiceMixin, self).dispatch(*args, **kwargs)
145
146
    def get_queryset(self):
147
        # get the Service of the connected user
148
        if self.request.user.is_authenticated():
149
            return self.queryset.filter(user=self.request.user,
150
                                        id=self.kwargs.get('pk'))
151
        # otherwise return nothing
152
        return UserService.objects.none()
153
154
155
class UserServiceUpdateView(UserServiceMixin, UpdateView):
156
    """

django_th/views.py 1 location

@@ 333-349 (lines=17) @@
330
329
328
327
326
325
324
323
322
321
320
319
318
317
316
315
314
313
312
311
310
309
308
307
306
305
304
303
302
301
300
299
298
297
296
295
294
293
292
291
290
289
288
287
286
285
284
283
282
281
280
279
278
277
276
275
274
273
272
271
270
269
268
267
266
265
264
263
262
261
260
259
258
257
256
255
254
253
252
251
250
249
248
247
246
245
244
243
242
241
240
239
238
237
236
235
234
233
232
231
230
229
228
227
226
225
224
223
222
221
220
219
218
217
216
215