Skip to content

Commit

Permalink
Add WikimediaProject model and related API endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
albertoleoncio committed Jan 11, 2025
1 parent 8f75585 commit ffeebbd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CapX/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from skills.views import SkillViewSet, SkillByTypeViewSet
from users.views import (
ProfileViewSet, UsersViewSet, QuickListViewSet,
UsersBySkillViewSet, UsersByTagViewSet, TerritoryViewSet,
UsersBySkillViewSet, UsersByTagViewSet, TerritoryViewSet, WikimediaProjectViewSet
)
from bugs.views import BugViewSet, AttachmentViewSet
from orgs.views import OrganizationViewSet, OrganizationTypeViewSet
Expand All @@ -38,6 +38,7 @@
router.register('skill', SkillViewSet, basename='skill')
router.register('users', UsersViewSet, basename='users')
router.register('profile', ProfileViewSet, basename='profile')
router.register('wikimedia_project', WikimediaProjectViewSet, basename='wikimedia_project')
router.register('territory', TerritoryViewSet, basename='territory')
router.register('organizations', OrganizationViewSet, basename='organizations')
router.register('organization_type', OrganizationTypeViewSet, basename='organization_type')
Expand Down
2 changes: 1 addition & 1 deletion users/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class WikimediaProjectSerializer(serializers.ModelSerializer):

class Meta:
model = WikimediaProject
fields = ['id', 'wikimedia_project_name', 'wikimedia_project_code']
fields = ['id', 'wikimedia_project_name', 'wikimedia_project_code', 'wikimedia_project_picture']

class OrganizationSerializer(serializers.ModelSerializer):

Expand Down
14 changes: 14 additions & 0 deletions users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,20 @@ def perform_destroy(self, instance):
instance.delete()
user.delete()

@extend_schema_view(
list=extend_schema(
summary='List all Wikimedia projects.',
description='This endpoint lists all Wikimedia projects.',
),
retrieve=extend_schema(
summary='Retrieve a Wikimedia project by ID.',
description='This endpoint retrieves a Wikimedia project by its ID.',
),
)
class WikimediaProjectViewSet(viewsets.ReadOnlyModelViewSet):
queryset = WikimediaProject.objects.all()
serializer_class = WikimediaProjectSerializer

@extend_schema_view(
list=extend_schema(
summary='List all territories.',
Expand Down

0 comments on commit ffeebbd

Please sign in to comment.