12:19 pm
PragetX
- Installation and Setup of Django Backends of PPP, InfinityTalks and PragetX backend
- Setup Postgres Database locally.
- Code Review of PPP.
PPP - PragetX
Pull Request
- Deletion of Category and SubCategory.
- Constraint of Deletion is Category can only be deleted if No subCategories Present.
- PR
Updated Destroy for Category to Prevent deletion and give status 400 if sub category exists.
class CategoryApi(CustomViewSetMaster):
# ...
def destroy(self, request, *args, **kwargs):
# If sub category is present then category can't be deleted
data = self.get_serializer(self.get_object(request)).data
sub_category = SubCategory.objects.filter(category=data["id"])
if sub_category:
return Response(
{"message": "Cannot delete Content Child Data.", "data":"not ", "status": False},
status=status.HTTP_400_BAD_REQUEST,
)
return super().destroy(request, *args, **kwargs)Links : Tags : Year : 2024 Month : March 24, March Date : 11th March, Monday, 2024, 11th March Category : Daily