Skip to content

Commit

Permalink
Use <file_guid> instead of <file_id> to avoid confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
cslzchen committed Feb 5, 2024
1 parent 33d73bf commit 060f08e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/files/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ class FileSerializer(BaseFileSerializer):

cedar_metadata_records = RelationshipField(
related_view='files:file-cedar-metadata-records-list',
related_view_kwargs={'file_id': 'get_file_guid_or_error'},
related_view_kwargs={'file_guid': 'get_file_guid_or_error'},
)

def get_target_type(self, obj):
Expand Down
2 changes: 1 addition & 1 deletion api/files/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

urlpatterns = [
re_path(r'^(?P<file_id>\w+)/$', views.FileDetail.as_view(), name=views.FileDetail.view_name),
re_path(r'^(?P<file_id>\w+)/cedar_metadata_records/$', views.FileCedarMetadataRecordsList.as_view(), name=views.FileCedarMetadataRecordsList.view_name),
re_path(r'^(?P<file_guid>\w+)/cedar_metadata_records/$', views.FileCedarMetadataRecordsList.as_view(), name=views.FileCedarMetadataRecordsList.view_name),
re_path(r'^(?P<file_id>\w+)/versions/$', views.FileVersionsList.as_view(), name=views.FileVersionsList.view_name),
re_path(r'^(?P<file_id>\w+)/versions/(?P<version_id>\w+)/$', views.FileVersionDetail.as_view(), name=views.FileVersionDetail.view_name),
]
2 changes: 1 addition & 1 deletion api/files/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class FileCedarMetadataRecordsList(JSONAPIBaseView, generics.ListAPIView, ListFi
view_name = 'file-cedar-metadata-records-list'

def get_default_queryset(self):
return CedarMetadataRecord.objects.filter(guid___id=self.kwargs['file_id'])
return CedarMetadataRecord.objects.filter(guid___id=self.kwargs['file_guid'])

def get_queryset(self):
return self.get_queryset_from_request()

0 comments on commit 060f08e

Please sign in to comment.