Skip to content

Commit 150583c

Browse files
committed
Fix filtering for already-posted news articles
We need to filter based on just the keys, not the values as well, when figuring out if there is anywhere left to post an article.
1 parent 243d1fa commit 150583c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pgweb/news/management/commands/social_post.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def handle(self, *args, **options):
3333
if not curs.fetchall()[0][0]:
3434
raise CommandError("Failed to get advisory lock, existing social_post process stuck?")
3535

36-
articles = list(NewsArticle.objects.filter(modstate=ModerationState.APPROVED, date__gt=datetime.now() - timedelta(days=7)).exclude(postedto__contains=allprovidernames).order_by('date'))
36+
articles = list(NewsArticle.objects.filter(modstate=ModerationState.APPROVED, date__gt=datetime.now() - timedelta(days=7)).exclude(postedto__has_keys=allprovidernames).order_by('date'))
3737
if not len(articles):
3838
return
3939

0 commit comments

Comments
 (0)