Hi Gavin,
You passed pk from URL.
class TeamInfo(APIView):
#...
def get(self, request, pk): # Add pk to params
club_pk = self.kwargs.get('pk') # get the pk
#...
return Response({
'club_pk': club_pk
})
Will pass
Hi Alvaro/Ranganath,
Appreciate your feedback, I understand what you are recommending but I can
seem to get it working.
Please see the below hopefully it will make more sense:
*View sample for team:*
class TeamInfo(APIView):
renderer_classes = [TemplateHTMLRenderer]
template_name =
You can define urlpatterns as below:
url(r'^club_home/$/teams/', include('clubkit.clubs.urls'), name='clubs'),
So that $ will match for any single value primary key.
On Sunday, March 10, 2019 at 2:57:43 PM UTC, GavinB841 wrote:
>
> Hi all,
>
> I am not sure if this is possible as I could find
Not sure I understand about the "pass that session key variable into the
URL argument". But if you want the URL
(http://127.0.0.1:8000/club_home//teams/) works, change this path:
urlpatterns = [
path('/teams/', views.club_home, name='club_home'),
]
On Sun, Mar 10, 2019 at 10:57 PM Gavin
Hi all,
I am not sure if this is possible as I could find nothing online but would
appreciate any alternative solution.
- In my view I obtain a pk which is set as a session key
- I need to pass that session key variable into the url argument.
e.g. http://127.0.0.1:8000/club_home//teams/
5 matches
Mail list logo