Spaces:
Running
Running
Commit
·
6b9394e
1
Parent(s):
4054de4
Refactor bhajanDetail view and URL pattern for improved clarity and consistency
Browse files- api/__pycache__/urls.cpython-313.pyc +0 -0
- api/__pycache__/views.cpython-313.pyc +0 -0
- api/urls.py +3 -1
- api/views.py +3 -3
api/__pycache__/urls.cpython-313.pyc
CHANGED
Binary files a/api/__pycache__/urls.cpython-313.pyc and b/api/__pycache__/urls.cpython-313.pyc differ
|
|
api/__pycache__/views.cpython-313.pyc
CHANGED
Binary files a/api/__pycache__/views.cpython-313.pyc and b/api/__pycache__/views.cpython-313.pyc differ
|
|
api/urls.py
CHANGED
@@ -13,7 +13,9 @@ urlpatterns = [
|
|
13 |
path("bhajan-list/<str:catLink>", views.bhajanList, name="bhajanList"),
|
14 |
path("bhajan-category-list/", views.bhajanCategoryList, name="bhajanCategoryList"),
|
15 |
path(
|
16 |
-
"bhajan-detail/<
|
|
|
|
|
17 |
),
|
18 |
path("event-list/", views.eventList, name="eventList"),
|
19 |
path("bhakto-list/", views.bhaktoList, name="bhaktoList"),
|
|
|
13 |
path("bhajan-list/<str:catLink>", views.bhajanList, name="bhajanList"),
|
14 |
path("bhajan-category-list/", views.bhajanCategoryList, name="bhajanCategoryList"),
|
15 |
path(
|
16 |
+
"bhajan-detail/<int:bhajanId>",
|
17 |
+
views.bhajanDetail,
|
18 |
+
name="bhajanDetail",
|
19 |
),
|
20 |
path("event-list/", views.eventList, name="eventList"),
|
21 |
path("bhakto-list/", views.bhaktoList, name="bhaktoList"),
|
api/views.py
CHANGED
@@ -121,9 +121,9 @@ def bhajanList(request, catLink):
|
|
121 |
)
|
122 |
|
123 |
|
124 |
-
def bhajanDetail(request,
|
125 |
-
bhajan = Bhajan.objects.
|
126 |
-
if bhajan
|
127 |
return JsonResponse({"error": "Bhajan not found"})
|
128 |
else:
|
129 |
return JsonResponse(
|
|
|
121 |
)
|
122 |
|
123 |
|
124 |
+
def bhajanDetail(request, bhajanId):
|
125 |
+
bhajan = Bhajan.objects.filter(bhajanId=bhajanId).first()
|
126 |
+
if not bhajan:
|
127 |
return JsonResponse({"error": "Bhajan not found"})
|
128 |
else:
|
129 |
return JsonResponse(
|