Re: ListView from 2 model

2019-10-08 Thread Jani Tiainen
Hi, ListView and most other generic views are designed mostly to work with single model. There are few ways to tackle your problem depending on your needs. to 3. lokak. 2019 klo 0.53 Yann Mbella kirjoitti: > hi everyone, > I got a problem in listing two models from a listview that is, a list

Re: ListView from 2 model

2019-10-08 Thread lemme smash
you probably may want to implement `get_context_data` method like: def get_context_data(self): context = super(BlogView, self).get_context_data() context.update({ 'authors': Author.objects.filter(posts__isnull=False).distinct(), 'tags':

Re: ListView from 2 model

2019-10-07 Thread Pradeep Sukhwani
Hi Yann, You can try queryset union functionality: class MultiFilterPlacesListView(ListAPIView): """Custom queryset api view. Does not implement pagination""" pagination_class = None # Import custom pagination if you need the pagination. queryset = Places.objects.all()

ListView from 2 model

2019-10-02 Thread Yann Mbella
hi everyone, I got a problem in listing two models from a listview that is, a list of one model and another model together (eg Books and Authors) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop