I found a great solution to avoid iterating over a list. This way, the Database retrieves the result with an extra column.
Performance is much better now, check it out:
journal_id = 10
query = 'SELECT COUNT(*) FROM data_journal_articles as data WHERE data.journal_id = %s AND data.article_id = data_article.id' % journal_id
articles = Article.objects.filter(
date__gte = request_data['start_date'],
date__lte = request_data['end_date'],
).extra(select={'is_checked': query})
The extra field is a counter of relations between a given journal and a given author. This result could be either one or zero. Depending on it, result will be shown differently in the front-end.
Cheers,