26
26
DocumentTypes ,
27
27
WorkflowStatusChoices ,
28
28
)
29
- from .models .delta_url import DeltaResolvedTitle , DeltaResolvedTitleError , DeltaUrl
30
- from .models .pattern import (
31
- DivisionPattern ,
32
- DocumentTypePattern ,
33
- ExcludePattern ,
34
- IncludePattern ,
35
- TitlePattern ,
29
+ from .models .delta_patterns import (
30
+ DeltaDivisionPattern ,
31
+ DeltaDocumentTypePattern ,
32
+ DeltaExcludePattern ,
33
+ DeltaIncludePattern ,
34
+ DeltaTitlePattern ,
36
35
)
36
+ from .models .delta_url import DeltaResolvedTitle , DeltaResolvedTitleError , DeltaUrl
37
37
from .serializers import (
38
38
CollectionReadSerializer ,
39
39
CollectionSerializer ,
@@ -325,7 +325,7 @@ def get_queryset(self):
325
325
326
326
327
327
class ExcludePatternViewSet (CollectionFilterMixin , viewsets .ModelViewSet ):
328
- queryset = ExcludePattern .objects .all ()
328
+ queryset = DeltaExcludePattern .objects .all ()
329
329
serializer_class = ExcludePatternSerializer
330
330
331
331
def get_queryset (self ):
@@ -335,17 +335,17 @@ def create(self, request, *args, **kwargs):
335
335
match_pattern = request .POST .get ("match_pattern" )
336
336
collection_id = request .POST .get ("collection" )
337
337
try :
338
- ExcludePattern .objects .get (
338
+ DeltaExcludePattern .objects .get (
339
339
collection_id = Collection .objects .get (id = collection_id ),
340
340
match_pattern = match_pattern ,
341
341
).delete ()
342
342
return Response (status = status .HTTP_200_OK )
343
- except ExcludePattern .DoesNotExist :
343
+ except DeltaExcludePattern .DoesNotExist :
344
344
return super ().create (request , * args , ** kwargs )
345
345
346
346
347
347
class IncludePatternViewSet (CollectionFilterMixin , viewsets .ModelViewSet ):
348
- queryset = IncludePattern .objects .all ()
348
+ queryset = DeltaIncludePattern .objects .all ()
349
349
serializer_class = IncludePatternSerializer
350
350
351
351
def get_queryset (self ):
@@ -355,25 +355,25 @@ def create(self, request, *args, **kwargs):
355
355
match_pattern = request .POST .get ("match_pattern" )
356
356
collection_id = request .POST .get ("collection" )
357
357
try :
358
- IncludePattern .objects .get (
358
+ DeltaIncludePattern .objects .get (
359
359
collection_id = Collection .objects .get (id = collection_id ),
360
360
match_pattern = match_pattern ,
361
361
).delete ()
362
362
return Response (status = status .HTTP_200_OK )
363
- except IncludePattern .DoesNotExist :
363
+ except DeltaIncludePattern .DoesNotExist :
364
364
return super ().create (request , * args , ** kwargs )
365
365
366
366
367
367
class TitlePatternViewSet (CollectionFilterMixin , viewsets .ModelViewSet ):
368
- queryset = TitlePattern .objects .all ()
368
+ queryset = DeltaTitlePattern .objects .all ()
369
369
serializer_class = TitlePatternSerializer
370
370
371
371
def get_queryset (self ):
372
372
return super ().get_queryset ().order_by ("match_pattern" )
373
373
374
374
375
375
class DocumentTypePatternViewSet (CollectionFilterMixin , viewsets .ModelViewSet ):
376
- queryset = DocumentTypePattern .objects .all ()
376
+ queryset = DeltaDocumentTypePattern .objects .all ()
377
377
serializer_class = DocumentTypePatternSerializer
378
378
379
379
def get_queryset (self ):
@@ -387,18 +387,18 @@ def create(self, request, *args, **kwargs):
387
387
collection_id = request .POST .get ("collection" )
388
388
match_pattern = request .POST .get ("match_pattern" )
389
389
try :
390
- DocumentTypePattern .objects .get (
390
+ DeltaDocumentTypePattern .objects .get (
391
391
collection_id = Collection .objects .get (id = collection_id ),
392
392
match_pattern = match_pattern ,
393
- match_pattern_type = DocumentTypePattern .MatchPatternTypeChoices .INDIVIDUAL_URL ,
393
+ match_pattern_type = DeltaDocumentTypePattern .MatchPatternTypeChoices .INDIVIDUAL_URL ,
394
394
).delete ()
395
395
return Response (status = status .HTTP_200_OK )
396
- except DocumentTypePattern .DoesNotExist :
396
+ except DeltaDocumentTypePattern .DoesNotExist :
397
397
return Response (status = status .HTTP_204_NO_CONTENT )
398
398
399
399
400
400
class DivisionPatternViewSet (CollectionFilterMixin , viewsets .ModelViewSet ):
401
- queryset = DivisionPattern .objects .all ()
401
+ queryset = DeltaDivisionPattern .objects .all ()
402
402
serializer_class = DivisionPatternSerializer
403
403
404
404
def get_queryset (self ):
0 commit comments