filter search from 2 models

31 views
Skip to first unread message

sotiris moustogiannis

unread,
Oct 9, 2019, 6:48:52 PM10/9/19
to Django users
I want to do dynamic filter search from 2 different models 

i have 2 models

md1.png

md2.png



i have this filters.py file to find shops and dates


fi.png


and this shop listview

li.png



i can only show the results of shopfilter and i want to do a combination of shops and appointments model




lemme smash

unread,
Oct 10, 2019, 10:36:51 AM10/10/19
to Django users
suggestion:
it's better to post code snippets as text (i.e. use `code` markup)
about your question: what you mean by "i want to do a combination"? you what to display both filters and both lists on the same page? in that case you want to setup custom view.

sotiris moustogiannis

unread,
Oct 10, 2019, 2:50:16 PM10/10/19
to Django users
generally, i want to use the 2 models(shops,appointments) in one list view in order to find available dates  for booking. I dont know the way to do this

lemme smash

unread,
Oct 11, 2019, 12:14:45 PM10/11/19
to Django users
just create custom view and add those two querysets to context. if you want to do search by one input in both querysets, you'll need to create custom filter as well, or just filter it in a view by query from input


On Thursday, October 10, 2019 at 1:48:52 AM UTC+3, sotiris moustogiannis wrote:

sotiris moustogiannis

unread,
Oct 11, 2019, 12:48:46 PM10/11/19
to Django users
thanks a lot. you helped me
Reply all
Reply to author
Forward
0 new messages