Skip to content

Commit

Permalink
Merge pull request #301 from openedx/ammare/remove-viewset-class-from…
Browse files Browse the repository at this point in the history
…-mixin

fix: Rename base class as mixin and remove `viewsets.ViewSet` from class list
  • Loading branch information
muhammad-ammar committed Apr 25, 2022
2 parents 0953e8b + a74cd7f commit f406a22
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Unreleased
----------

=========================
[4.2.5] - 2022-04-22
---------------------
* Rename base class to a more appropriate name
* Remove `viewsets.ViewSet` from base class

[4.2.4] - 2022-04-18
---------------------
* Make API endpoints readonly.
Expand Down
2 changes: 1 addition & 1 deletion enterprise_data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
Enterprise data api application. This Django app exposes API endpoints used by enterprises.
"""

__version__ = "4.2.4"
__version__ = "4.2.5"

default_app_config = "enterprise_data.apps.EnterpriseDataAppConfig" # pylint: disable=invalid-name
8 changes: 4 additions & 4 deletions enterprise_data/api/v0/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def subtract_one_month(original_date):
return one_month_earlier


class EnterpriseViewSet(PermissionRequiredMixin, viewsets.ViewSet):
class EnterpriseViewSetMixin(PermissionRequiredMixin):
"""
Base class for all Enterprise view sets.
"""
Expand All @@ -61,7 +61,7 @@ def paginate_queryset(self, queryset):
return super().paginate_queryset(queryset) # pylint: disable=no-member


class EnterpriseEnrollmentsViewSet(EnterpriseViewSet, viewsets.ReadOnlyModelViewSet):
class EnterpriseEnrollmentsViewSet(EnterpriseViewSetMixin, viewsets.ReadOnlyModelViewSet):
"""
Viewset for routes related to Enterprise course enrollments.
"""
Expand Down Expand Up @@ -232,7 +232,7 @@ def overview(self, request, **kwargs):
return Response(content)


class EnterpriseUsersViewSet(EnterpriseViewSet, viewsets.ReadOnlyModelViewSet):
class EnterpriseUsersViewSet(EnterpriseViewSetMixin, viewsets.ReadOnlyModelViewSet):
"""
Viewset for routes related to Enterprise users.
"""
Expand Down Expand Up @@ -330,7 +330,7 @@ def list(self, request, **kwargs): # pylint: disable=arguments-differ
return Response(serializer.data)


class EnterpriseLearnerCompletedCoursesViewSet(EnterpriseViewSet, viewsets.ReadOnlyModelViewSet):
class EnterpriseLearnerCompletedCoursesViewSet(EnterpriseViewSetMixin, viewsets.ReadOnlyModelViewSet):
"""
View to manage enterprise learner completed course enrollments.
"""
Expand Down
8 changes: 4 additions & 4 deletions enterprise_data/api/v1/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def subtract_one_month(original_date):
return one_month_earlier


class EnterpriseViewSet(PermissionRequiredMixin, viewsets.ViewSet):
class EnterpriseViewSetMixin(PermissionRequiredMixin):
"""
Base class for all Enterprise view sets.
"""
Expand All @@ -56,7 +56,7 @@ def paginate_queryset(self, queryset):
return super().paginate_queryset(queryset) # pylint: disable=no-member


class EnterpriseLearnerEnrollmentViewSet(EnterpriseViewSet, viewsets.ReadOnlyModelViewSet):
class EnterpriseLearnerEnrollmentViewSet(EnterpriseViewSetMixin, viewsets.ReadOnlyModelViewSet):
"""
Viewset for routes related to Enterprise course enrollments.
"""
Expand Down Expand Up @@ -250,7 +250,7 @@ def overview(self, request, **kwargs):
return Response(content)


class EnterpriseLearnerViewSet(EnterpriseViewSet, viewsets.ReadOnlyModelViewSet):
class EnterpriseLearnerViewSet(EnterpriseViewSetMixin, viewsets.ReadOnlyModelViewSet):
"""
Viewset for routes related to Enterprise Learners.
"""
Expand Down Expand Up @@ -355,7 +355,7 @@ def list(self, request, **kwargs): # pylint: disable=arguments-differ
return Response(serializer.data)


class EnterpriseLearnerCompletedCoursesViewSet(EnterpriseViewSet, viewsets.ReadOnlyModelViewSet):
class EnterpriseLearnerCompletedCoursesViewSet(EnterpriseViewSetMixin, viewsets.ReadOnlyModelViewSet):
"""
View to manage enterprise learner completed course enrollments.
"""
Expand Down

0 comments on commit f406a22

Please sign in to comment.