path('clock/view/<user_id>', views.ClockInOutViewListView.as_view(), name='admin_timesheet_clock_in_out_view'),
I am passing user_id
in url and looks like this -
http://localhost:8000/timesheet/clock/view/13
I want that user_id
in my template to reuse that user_id
Example - 13
.
I was trying to {{user_id}}
in my template but it did not got any value
How can i get that 13
value in my template which is passed in my url
class ClockInOutViewListView(LoginRequiredMixin, generic.TemplateView):
template_name = 'clock/clock-view.html'
def get_context_data(self, user_id, **kwargs):
context = super(ClockInOutViewListView, self).get_context_data(**kwargs)
try:
context['views'] = TimesheetEntry.objects.filter(
timesheet_users = user_id,
).order_by('-id')
except: pass
return context