Re: filter two columns django

2019-03-17 Thread omar ahmed
thank you Shashank very much it works On Sunday, March 17, 2019 at 4:02:46 PM UTC+2, Shashank Singh wrote: > > OR > from django.db.models import Q > news_list = > LeagueNews.objects.filter(Q(publication_date__lte=timezone.now)|Q(league_name='english')).order_by('-publication_date')[:10] > > AND

Re: filter two columns django

2019-03-17 Thread Shashank Singh
OR from django.db.models import Q news_list = LeagueNews.objects.filter(Q(publication_date__lte=timezone.now)|Q(league_name='english')).order_by('-publication_date')[:10] AND news_list = LeagueNews.objects.filter(publication_date__lte=timezone.now,

filter two columns django

2019-03-17 Thread omar ahmed
hi guys this is my view def premierleague(request): news_list = LeagueNews.objects.filter((publication_date__lte=timezone.now)|(league_name='english')).order_by('-publication_date')[:10] return render(request, 'core/premierleague.html', {'news_list':news_list}) i want to filter my objects by two