groups_api package
Subpackages
- groups_api.migrations package
- groups_api.tests package
- Submodules
- groups_api.tests.conftest module
- groups_api.tests.test_groups_rest module
test_admin_can_create_groups()
test_admin_can_get_groups()
test_admin_can_rename_groups()
test_admin_cant_delete_groups()
test_cant_revoke_default_permissions()
test_empty_group_with_permissions_is_shown()
test_grant_permission_creates_new_group()
test_grant_permission_creates_new_group_case_sensitive()
test_grant_permission_for_group()
test_group_has_all_datasets()
test_group_has_all_users()
test_group_retrieve()
test_group_retrieve_alphabetical_order()
test_group_retrieve_missing()
test_groups_have_ids_and_names()
test_groups_have_users_and_datasets()
test_groups_pagination()
test_groups_search()
test_groups_search_pagination()
test_no_empty_groups_are_accessible()
test_not_admin_cant_grant_permissions()
test_not_admin_cant_revoke_permissions()
test_not_admin_grant_permissions_does_not_create_group()
test_revoke_permission_for_group()
test_single_group_has_users_and_datasets()
test_user_cant_create_groups()
test_user_cant_see_groups()
test_user_group_routes()
- Module contents
Submodules
groups_api.serializers module
- class groups_api.serializers.GroupCreateSerializer(*args, **kwargs)[source]
Bases:
ModelSerializer
Serializer used for group creation.
- create(validated_data: dict[str, str]) Group [source]
We have a bit of extra checking around this in order to provide descriptive messages when something goes wrong, but this method is essentially just:
return ExampleModel.objects.create(**validated_data)
If there are many to many fields present on the instance then they cannot be set until the model is instantiated, in which case the implementation is like so:
example_relationship = validated_data.pop(‘example_relationship’) instance = ExampleModel.objects.create(**validated_data) instance.example_relationship = example_relationship return instance
The default implementation also does not handle nested relationships. If you want to support writable nested relationships you’ll need to write an explicit .create() method.
groups_api.urls module
groups_api.views module
- class groups_api.views.GroupsViewSet(**kwargs)[source]
Bases:
CreateModelMixin
,UpdateModelMixin
,ReadOnlyModelViewSet
Groups view set.
- authentication_classes = [<class 'utils.authentication.SessionAuthenticationWithoutCSRF'>, <class 'utils.authentication.GPFOAuth2Authentication'>]
- basename = None
- description = None
- detail = None
- filter_backends = (<class 'rest_framework.filters.SearchFilter'>,)
- get_queryset() QuerySet [source]
Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
- get_serializer_class() Type[GroupSerializer] [source]
Return the class to use for the serializer. Defaults to using self.serializer_class.
You may want to override this if you need to provide different serializations depending on the incoming request.
(Eg. admins get full serialization, others get basic serialization)
- lookup_field = 'name'
- name = None
- permission_classes = (<class 'rest_framework.permissions.IsAdminUser'>,)
- search_fields = ('name',)
- serializer_class
alias of
GroupSerializer
- suffix = None