diff --git a/uhepp_org/uhepp_api/views.py b/uhepp_org/uhepp_api/views.py index ebe07dc6825314f10a426c973436fc1c14a841bc..fd2737ebb5ac11a7d95086c1561593201505eddb 100644 --- a/uhepp_org/uhepp_api/views.py +++ b/uhepp_org/uhepp_api/views.py @@ -41,7 +41,7 @@ class UserViewSet(MaskedRelatedMixin, viewsets.ReadOnlyModelViewSet): location = {'Location': api_url} return { - "Link": f'{ui_url}; rel="ui"', + "Link": f'<{ui_url}>; rel="ui"', **location } @@ -81,7 +81,7 @@ class CollectionViewSet(viewsets.ModelViewSet): location = {"Location": api_url} return { - "Link": f'{ui_url}; rel="ui"', + "Link": f'<{ui_url}>; rel="ui"', **location } @@ -128,7 +128,7 @@ class PlotViewSet(viewsets.ModelViewSet): permission_classes = [IsCollectionOwnerOrReadOnly] def create(self, request, *args, **kwds): - serializer = self.get_serializer_visible(data=request.data) + serializer = self.get_serializer(data=request.data) serializer.is_valid(raise_exception=True) prototype = Namespace(**serializer.validated_data) @@ -151,7 +151,7 @@ class PlotViewSet(viewsets.ModelViewSet): location = {"Location": api_url} return { - "Link": f'{ui_url}; rel="ui"', + "Link": f'<{ui_url}>; rel="ui"', "X-Resource-UUID": uuid, **location } @@ -165,22 +165,6 @@ class PlotViewSet(viewsets.ModelViewSet): def get_serializer(self, *args, **kwds): serializer = super().get_serializer(*args, **kwds) - # Filter queryset for browsable API choices - patching = serializer - if hasattr(patching, "child"): - patching = patching.child - - queryset = patching.fields["collection"].queryset - if self.request.user.is_authenticated: - patching.fields["collection"].queryset = queryset.filter(owner=self.request.user) - else: - patching.fields["collection"].queryset = queryset.none() - - return serializer - - def get_serializer_visible(self, *args, **kwds): - serializer = super().get_serializer(*args, **kwds) - # Filter queryset for browsable API choices patching = serializer if hasattr(patching, "child"): diff --git a/uhepp_org/uhepp_vault/models.py b/uhepp_org/uhepp_vault/models.py index 720d3850df142214f57371d943da9c390cf7aaf4..546a18f4ec2271684dce903afbcae60a6b98e3cc 100644 --- a/uhepp_org/uhepp_vault/models.py +++ b/uhepp_org/uhepp_vault/models.py @@ -12,9 +12,9 @@ PRIVATE_LEVEL = 10 INTERNAL_LEVEL = 20 PUBLIC_LEVEL = 30 VISIBILITY_LEVELS = [ - (PUBLIC_LEVEL, _("Publicly accessible")), + (PRIVATE_LEVEL, _("Accessible only by you")), (INTERNAL_LEVEL, _("Accessible only by members of your collaboration")), - (PRIVATE_LEVEL, _("Accessible only by you")) + (PUBLIC_LEVEL, _("Publicly accessible")), ] class Collection(models.Model): diff --git a/uhepp_org/uhepp_vault/templates/uhepp_vault/home.html b/uhepp_org/uhepp_vault/templates/uhepp_vault/home.html index cbbb003a256845db6ad626002bc403da40cda90e..20fe0dfb5e5ad01299fbd9407363fdefdc55a8e4 100644 --- a/uhepp_org/uhepp_vault/templates/uhepp_vault/home.html +++ b/uhepp_org/uhepp_vault/templates/uhepp_vault/home.html @@ -1,2 +1 @@ <p>uhepp.org – home of {{ plot_count }} plots</p> -<a href="{% url 'uhepp_vault:plot-index' %}">Browser index</a> diff --git a/uhepp_org/uhepp_vault/urls.py b/uhepp_org/uhepp_vault/urls.py index 99205b7c286c3263061be56a09ba3126cdf146b7..982b1a42917b170c37f08be0099a8822630938a8 100644 --- a/uhepp_org/uhepp_vault/urls.py +++ b/uhepp_org/uhepp_vault/urls.py @@ -5,7 +5,7 @@ from . import views app_name = 'uhepp_vault' urlpatterns = [ - # path('', views.home, name='home'), + path('', views.home, name='home'), # path('p/', views.PlotIndex.as_view(), name='plot-index'), # path('accounts/', views.account, name='account'), # path('accounts/login/', auth_views.LoginView.as_view()),