Commit 3cc9c8fc authored by Gladys Forte's avatar Gladys Forte

delete all related to Branch Api

parent 3f6bd4cc
from rest_framework import serializers
from app.entities.models import Branch
class BranchSerializer(serializers.ModelSerializer):
class Meta:
model = Branch
fields = '__all__'
from app.entities.models import Branch
from rest_framework import viewsets, status
from rest_framework.response import Response
from django_filters import rest_framework as filters
from app.applicationlayer.master.branch.serializer import BranchSerializer
from app.applicationlayer.utils import (CustomPagination,
status_message_response)
class BranchViewSet(viewsets.ModelViewSet):
queryset = Branch.objects.all()
serializer_class = BranchSerializer
pagination_class = CustomPagination
lookup_field = 'id'
def list(self, request, *args, **kwargs):
queryset = self.filter_queryset(self.get_queryset())
page = self.paginate_queryset(queryset)
if page is not None:
serializer = self.get_serializer(page, many=True)
message = status_message_response(
200,
'success',
'list of branches found',
serializer.data
)
return self.get_paginated_response(message)
serializer = self.get_serializer(queryset, many=True)
return Response(serializer.data)
...@@ -6,14 +6,12 @@ from app.applicationlayer.master.company.views import AdminCompanyViewSet ...@@ -6,14 +6,12 @@ from app.applicationlayer.master.company.views import AdminCompanyViewSet
from app.applicationlayer.master.department.views import AdminDepartmentViewSet from app.applicationlayer.master.department.views import AdminDepartmentViewSet
from app.applicationlayer.master.user_type.views import UserTypeViewSet from app.applicationlayer.master.user_type.views import UserTypeViewSet
from app.applicationlayer.master.attachment.views import MasterAttachmentViewSet from app.applicationlayer.master.attachment.views import MasterAttachmentViewSet
from app.applicationlayer.master.branch.views import BranchViewSet
router = routers.DefaultRouter() router = routers.DefaultRouter()
router.register(r'users', AdminAccountViewSet) router.register(r'users', AdminAccountViewSet)
router.register(r'companies', AdminCompanyViewSet) router.register(r'companies', AdminCompanyViewSet)
router.register(r'departments', AdminDepartmentViewSet) router.register(r'departments', AdminDepartmentViewSet)
router.register(r'attachments', MasterAttachmentViewSet) router.register(r'attachments', MasterAttachmentViewSet)
router.register(r'branches', BranchViewSet)
urlpatterns = [ urlpatterns = [
path('', include(router.urls)), path('', include(router.urls)),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment