API (Rest Framework)¶
Bases: ImportStartActionMixin, BaseImportJobViewSet
Base API viewset for ImportJob model.
Based on resource_class it will generate an endpoint which will allow to start an import to model which was specified in resource_class. On success this endpoint we return an instance of import.
Endpoints
- list - to get list of all import jobs
- details(retrieve) - to get status of import job
- start - create import job and start parsing data from attached file
- confirm - confirm import after parsing process is finished
- cancel - stop importing/parsing process and cancel this import job
Source code in import_export_extensions/api/views/import_job.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
get_queryset()
¶
Filter import jobs by resource used in viewset.
Source code in import_export_extensions/api/views/import_job.py
129 130 131 132 133 134 135 136 | |
Bases: ExportStartActionMixin, BaseExportJobViewSet
Base API viewset for ExportJob model.
Based on resource_class it will generate an endpoint which will allow to start an export of model which was specified in resource_class. This endpoint will support filtration based on FilterSet class specified in resource. On success this endpoint we return an instance of export, to get status of job, just use detail(retrieve) endpoint.
Source code in import_export_extensions/api/views/export_job.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
get_queryset()
¶
Filter export jobs by resource used in viewset.
Source code in import_export_extensions/api/views/export_job.py
103 104 105 106 107 108 109 110 | |
Bases: LimitQuerySetToCurrentUserMixin, ImportJobViewSet
Viewset for providing import feature to users.
Source code in import_export_extensions/api/views/import_job.py
138 139 140 141 142 | |
Bases: LimitQuerySetToCurrentUserMixin, ExportJobViewSet
Viewset for providing export feature to users.
Source code in import_export_extensions/api/views/export_job.py
113 114 115 116 117 | |
Bases: ListModelMixin, RetrieveModelMixin, GenericViewSet
Base viewset for managing import jobs.
Source code in import_export_extensions/api/views/import_job.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
__init_subclass__()
¶
Dynamically create an cancel api endpoints.
Need to do this to enable action and correct open-api spec generated by drf_spectacular.
Source code in import_export_extensions/api/views/import_job.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
cancel(*args, **kwargs)
¶
Cancel import job that is in progress.
Source code in import_export_extensions/api/views/import_job.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
confirm(*args, **kwargs)
¶
Confirm import job that has parsed status.
Source code in import_export_extensions/api/views/import_job.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
Bases: ListModelMixin, RetrieveModelMixin, GenericViewSet
Base viewset for managing export jobs.
Source code in import_export_extensions/api/views/export_job.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
__init_subclass__()
¶
Dynamically create an cancel api endpoints.
Need to do this to enable action and correct open-api spec generated by drf_spectacular.
Source code in import_export_extensions/api/views/export_job.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
cancel(*args, **kwargs)
¶
Cancel export job that is in progress.
Source code in import_export_extensions/api/views/export_job.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
Bases: LimitQuerySetToCurrentUserMixin, BaseImportJobViewSet
Viewset for providing export job management to users.
Source code in import_export_extensions/api/views/import_job.py
144 145 146 147 148 | |
Bases: LimitQuerySetToCurrentUserMixin, BaseExportJobViewSet
Viewset for providing export job management to users.
Source code in import_export_extensions/api/views/export_job.py
119 120 121 122 123 | |
Make queryset to return only current user jobs.
Source code in import_export_extensions/api/mixins/common.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
get_queryset()
¶
Return user's jobs.
Source code in import_export_extensions/api/mixins/common.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
Mixin which adds start import action.
Source code in import_export_extensions/api/mixins/import_mixins.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
get_import_create_serializer_class()
¶
Get serializer which will be used to start import job.
Source code in import_export_extensions/api/mixins/import_mixins.py
91 92 93 94 95 | |
get_import_detail_serializer_class()
¶
Get serializer which will be used show details of import job.
Source code in import_export_extensions/api/mixins/import_mixins.py
85 86 87 88 89 | |
get_import_resource_kwargs()
¶
Provide extra arguments to resource class.
Source code in import_export_extensions/api/mixins/import_mixins.py
97 98 99 | |
get_queryset()
¶
Return import model queryset on import action.
For better openapi support and consistency.
Source code in import_export_extensions/api/mixins/import_mixins.py
75 76 77 78 79 80 81 82 83 | |
get_serializer(*args, **kwargs)
¶
Provide resource kwargs to serializer class.
Source code in import_export_extensions/api/mixins/import_mixins.py
101 102 103 104 105 106 107 108 | |
start_import(request)
¶
Validate request data and start ImportJob.
Source code in import_export_extensions/api/mixins/import_mixins.py
110 111 112 113 114 115 116 117 118 119 120 121 122 | |
Mixin which adds start export action.
Source code in import_export_extensions/api/mixins/export_mixins.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
get_export_create_serializer_class()
¶
Get serializer which will be used to start export job.
Source code in import_export_extensions/api/mixins/export_mixins.py
111 112 113 114 115 | |
get_export_detail_serializer_class()
¶
Get serializer which will be used show details of export job.
Source code in import_export_extensions/api/mixins/export_mixins.py
105 106 107 108 109 | |
get_export_resource_kwargs()
¶
Provide extra arguments to resource class.
Source code in import_export_extensions/api/mixins/export_mixins.py
117 118 119 | |
get_queryset()
¶
Return export model queryset on export action.
For better openapi support and consistency.
Source code in import_export_extensions/api/mixins/export_mixins.py
95 96 97 98 99 100 101 102 103 | |
get_serializer(*args, **kwargs)
¶
Provide resource kwargs to serializer class.
Source code in import_export_extensions/api/mixins/export_mixins.py
121 122 123 124 125 126 127 128 | |
start_export(request)
¶
Validate request data and start ExportJob.
Source code in import_export_extensions/api/mixins/export_mixins.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
Bases: Serializer
Base Serializer to start export job.
It used to set up base workflow of ExportJob creation via API.
Source code in import_export_extensions/api/serializers/export_job.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
__init__(*args, ordering=None, filter_kwargs=None, resource_kwargs=None, **kwargs)
¶
Set ordering, filter kwargs and current user.
Source code in import_export_extensions/api/serializers/export_job.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
create(validated_data)
¶
Create export job.
Source code in import_export_extensions/api/serializers/export_job.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
update(instance, validated_data)
¶
Empty method to pass linters checks.
Source code in import_export_extensions/api/serializers/export_job.py
98 99 | |
validate(attrs)
¶
Check that ordering and filter kwargs are valid.
Source code in import_export_extensions/api/serializers/export_job.py
69 70 71 72 73 74 75 76 77 | |
Bases: Serializer
Base Serializer to start import job.
It used to set up base workflow of ImportJob creation via API.
Source code in import_export_extensions/api/serializers/import_job.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
__init__(*args, resource_kwargs=None, **kwargs)
¶
Set filter kwargs and current user.
Source code in import_export_extensions/api/serializers/import_job.py
99 100 101 102 103 104 105 106 107 108 109 | |
create(validated_data)
¶
Create import job.
Source code in import_export_extensions/api/serializers/import_job.py
111 112 113 114 115 116 117 118 119 120 121 122 123 | |
update(instance, validated_data)
¶
Empty method to pass linters checks.
Source code in import_export_extensions/api/serializers/import_job.py
125 126 | |
Bases: ModelSerializer
Serializer to show information about export job.
Source code in import_export_extensions/api/serializers/export_job.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
Bases: ModelSerializer
Serializer to show information about import job.
Source code in import_export_extensions/api/serializers/import_job.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
Bases: Serializer
Serializer to show progress of job.
Source code in import_export_extensions/api/serializers/progress.py
11 12 13 14 | |
Bases: Serializer
Serializer to show progress info, like how much is done.
Source code in import_export_extensions/api/serializers/progress.py
4 5 6 7 8 | |