|
|
@ -85,11 +85,11 @@ class HadisListView(ListAPIView): |
|
|
|
|
|
|
|
|
class HadisBasicView(RetrieveAPIView): |
|
|
class HadisBasicView(RetrieveAPIView): |
|
|
""" |
|
|
""" |
|
|
API view to retrieve basic Hadis information by hadis_id |
|
|
|
|
|
|
|
|
API view to retrieve basic Hadis information by hadis_slug |
|
|
""" |
|
|
""" |
|
|
serializer_class = HadisBasicSerializer |
|
|
serializer_class = HadisBasicSerializer |
|
|
lookup_field = 'id' |
|
|
|
|
|
lookup_url_kwarg = 'hadis_id' |
|
|
|
|
|
|
|
|
lookup_field = 'slug' |
|
|
|
|
|
lookup_url_kwarg = 'hadis_slug' |
|
|
|
|
|
|
|
|
@hadis_basic_swagger |
|
|
@hadis_basic_swagger |
|
|
def get(self, request, *args, **kwargs): |
|
|
def get(self, request, *args, **kwargs): |
|
|
@ -101,11 +101,11 @@ class HadisBasicView(RetrieveAPIView): |
|
|
|
|
|
|
|
|
class HadisDetailView(RetrieveAPIView): |
|
|
class HadisDetailView(RetrieveAPIView): |
|
|
""" |
|
|
""" |
|
|
API view to retrieve detailed Hadis information by hadis_id (excluding transmitters and corrections) |
|
|
|
|
|
|
|
|
API view to retrieve detailed Hadis information by hadis_slug (excluding transmitters and corrections) |
|
|
""" |
|
|
""" |
|
|
serializer_class = HadisDetailSerializer |
|
|
serializer_class = HadisDetailSerializer |
|
|
lookup_field = 'id' |
|
|
|
|
|
lookup_url_kwarg = 'hadis_id' |
|
|
|
|
|
|
|
|
lookup_field = 'slug' |
|
|
|
|
|
lookup_url_kwarg = 'hadis_slug' |
|
|
|
|
|
|
|
|
@hadis_detail_swagger |
|
|
@hadis_detail_swagger |
|
|
def get(self, request, *args, **kwargs): |
|
|
def get(self, request, *args, **kwargs): |
|
|
@ -129,7 +129,8 @@ class HadisTransmittersView(RetrieveAPIView): |
|
|
if a ?layer=slug param is provided. |
|
|
if a ?layer=slug param is provided. |
|
|
""" |
|
|
""" |
|
|
serializer_class = HadisTransmitterListSerializer |
|
|
serializer_class = HadisTransmitterListSerializer |
|
|
lookup_url_kwarg = 'hadis_id' |
|
|
|
|
|
|
|
|
lookup_field = 'slug' |
|
|
|
|
|
lookup_url_kwarg = 'hadis_slug' |
|
|
|
|
|
|
|
|
@hadis_transmitters_swagger |
|
|
@hadis_transmitters_swagger |
|
|
def get(self, request, *args, **kwargs): |
|
|
def get(self, request, *args, **kwargs): |
|
|
@ -162,8 +163,8 @@ class HadisCorrectionsView(ListAPIView): |
|
|
API view to retrieve corrections for a specific hadis |
|
|
API view to retrieve corrections for a specific hadis |
|
|
""" |
|
|
""" |
|
|
serializer_class = HadisCorrectionSerializer |
|
|
serializer_class = HadisCorrectionSerializer |
|
|
lookup_field = 'id' |
|
|
|
|
|
lookup_url_kwarg = 'hadis_id' |
|
|
|
|
|
|
|
|
lookup_field = 'slug' |
|
|
|
|
|
lookup_url_kwarg = 'hadis_slug' |
|
|
|
|
|
|
|
|
@hadis_corrections_swagger |
|
|
@hadis_corrections_swagger |
|
|
def get(self, request, *args, **kwargs): |
|
|
def get(self, request, *args, **kwargs): |
|
|
@ -187,7 +188,11 @@ class HadisCorrectionsView(ListAPIView): |
|
|
# }) |
|
|
# }) |
|
|
|
|
|
|
|
|
def get_queryset(self): |
|
|
def get_queryset(self): |
|
|
hadis_id = self.kwargs.get('hadis_id') |
|
|
|
|
|
if not HadisCorrection.objects.filter(hadis=hadis_id).exists(): |
|
|
|
|
|
return Hadis.objects.none() |
|
|
|
|
|
return HadisCorrection.objects.filter(hadis=hadis_id) |
|
|
|
|
|
|
|
|
hadis_slug = self.kwargs.get('hadis_slug') |
|
|
|
|
|
try: |
|
|
|
|
|
hadis = Hadis.objects.get(slug=hadis_slug, status=True) |
|
|
|
|
|
if not HadisCorrection.objects.filter(hadis=hadis).exists(): |
|
|
|
|
|
return Hadis.objects.none() |
|
|
|
|
|
return HadisCorrection.objects.filter(hadis=hadis) |
|
|
|
|
|
except Hadis.DoesNotExist: |
|
|
|
|
|
return HadisCorrection.objects.none() |