forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
819 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
""" | ||
Taxonomies API URLs. | ||
""" | ||
|
||
from django.urls import path, include | ||
|
||
from .v1 import urls as v1_urls | ||
|
||
urlpatterns = [path("v1/", include(v1_urls))] |
Empty file.
45 changes: 45 additions & 0 deletions
45
openedx/features/content_tagging/rest_api/v1/serializers.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
""" | ||
API Serializers for taxonomies org | ||
""" | ||
|
||
from rest_framework import serializers | ||
|
||
from openedx_tagging.core.tagging.models import Taxonomy | ||
from openedx_tagging.core.tagging.rest_api.v1.serializers import TaxonomyListQueryParamsSerializer | ||
|
||
from organizations.models import Organization | ||
|
||
|
||
class OrganizationField(serializers.Field): | ||
def to_representation(self, value): | ||
return value.short_name | ||
|
||
def to_internal_value(self, data): | ||
try: | ||
return Organization.objects.get(short_name=data) | ||
except Organization.DoesNotExist: | ||
raise serializers.ValidationError("Invalid organization short name") | ||
|
||
class TaxonomyOrgListQueryParamsSerializer(TaxonomyListQueryParamsSerializer): | ||
""" | ||
Serializer for the query params for the GET view | ||
""" | ||
|
||
org = OrganizationField(required=False) | ||
|
||
# class TaxonomySerializer(serializers.ModelSerializer): | ||
# class Meta: | ||
# model = Taxonomy | ||
# fields = [ | ||
# "id", | ||
# "name", | ||
# "description", | ||
# "enabled", | ||
# "required", | ||
# "allow_multiple", | ||
# "allow_free_text", | ||
# "system_defined", | ||
# "visible_to_authors", | ||
# ] | ||
|
||
|
Oops, something went wrong.