|
39 | 39 | from core.collections.utils import is_version_specified |
40 | 40 | from core.common.constants import ( |
41 | 41 | HEAD, RELEASED_PARAM, PROCESSING_PARAM, OK_MESSAGE, |
42 | | - ACCESS_TYPE_NONE, INCLUDE_RETIRED_PARAM, INCLUDE_INVERSE_MAPPINGS_PARAM, ALL) |
| 42 | + ACCESS_TYPE_NONE, INCLUDE_RETIRED_PARAM, INCLUDE_INVERSE_MAPPINGS_PARAM, ALL, LATEST) |
43 | 43 | from core.common.exceptions import Http409, Http405 |
44 | 44 | from core.common.mixins import ( |
45 | 45 | ConceptDictionaryCreateMixin, ListWithHeadersMixin, ConceptDictionaryUpdateMixin, |
@@ -107,6 +107,13 @@ def get_filter_params(self, default_version_to_head=True): |
107 | 107 | version = query_params.get('version', None) or self.kwargs.get('version', None) |
108 | 108 | if not version and default_version_to_head: |
109 | 109 | version = HEAD |
| 110 | + if version == LATEST: |
| 111 | + version = Collection.find_latest_released_version_by( |
| 112 | + { |
| 113 | + **{'user__username': self.kwargs.get('user'), 'organization__mnemonic': self.kwargs.get('org')}, |
| 114 | + 'mnemonic': self.kwargs['collection'] |
| 115 | + }) |
| 116 | + version = get(version, 'version') |
110 | 117 |
|
111 | 118 | kwargs = self.kwargs.copy() |
112 | 119 | if self.user_is_self and self.request.user.is_authenticated: |
|
0 commit comments