Views.py
class citydetailview(generic.DetailView):
#Generic class-based list view for a list of cities.
model = City
def get_city_value(request, pk):
if pk==1:
hyd=Type_city1.objects.all()
elif pk==2:
hyd=Type_city2.objects.all()
elif pk==3:
hyd=Type_city3.objects.all()
return (request,{'hyd':hyd})
urls.py
path('city/<int:pk>', views.citydetailview.as_view(), name='city_ads_detail'),
I want to use the 'pk' value from the urls.py in one of my class and render the output accordingly to template