I have this listview and the list datetimelist
And i want to pass this list to ShopDetailView class based view
Also, here are my urls that calls these classes
-- class ShopListView(ListView): model = Shops context_object_name= 'shops' template_name = 'booking/search.html'
def get_queryset(self): query = self.request.GET.get('q') query1 = self.request.GET.get('q1') query2 = self.request.GET.get('q2') query3 = self.request.GET.get('q3') datetimelist = [query,query1,query2,query3] result_list = Shops.objects.exclude(Q(appointments__time=query) & Q(appointments__date = query1)) result_list2 = Shops.objects.filter(Q(city=query2) & Q(typesport=query3)) context = list(chain(result_list & result_list2)) return contextAnd i want to pass this list to ShopDetailView class based view
class ShopDetailView(DetailView):
model = Shops template_name = 'booking/results.html'
context_object_name= 'shops'Also, here are my urls that calls these classes
path('search/', booking_views.ShopListView.as_view(template_name='booking/search.html'), name='search'), path('results/<int:pk>/', booking_views.ShopDetailView.as_view(template_name='booking/results.html'), name='results'),You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2122654c-342d-4874-b2de-2c0f21734b8a%40googlegroups.com.
No comments:
Post a Comment