Skip to content

Commit

Permalink
Merge pull request #3537 from artragis/patch-9
Browse files Browse the repository at this point in the history
[betav18] fix 3490
  • Loading branch information
gustavi committed Apr 11, 2016
2 parents 464434f + 9023709 commit fb73363
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions zds/tutorialv2/management/commands/migrate_to_zep25.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,8 @@ def alert_authors():
get_object_or_404(User, username=settings.ZDS_APP['member']['anonymous_account']),
get_object_or_404(User, username=settings.ZDS_APP['member']['external_account'])
]
users = []
contents = PublishableContent.objects.all()
for content in contents:
authors = content.authors.all()
for author in authors:
if author not in users and author not in bots:
users.append(author)
authors_pk = set(PublishableContent.objects.value_list("authors__pk", flat=True)) - set(bots)
users = list(User.objects.filter(pk__in=list(authors_pk)))
for user in users:
msg = 'Bonjour {0},\n\nDepuis la dernière version de Zeste de Savoir, tous les contenus (articles, tutoriels ' \
'et bientôt tribunes libres) possèdent une nouvelle classification ([ZEP-25](https://zestedesavoir.com' \
Expand All @@ -160,7 +155,7 @@ def alert_authors():
[user],
'Changement de classification des contenus sur Zeste de Savoir',
'Ce qui change pour vous en tant qu\'auteur',
msg.format(author.username, author.pk, author.pk)
msg.format(user.username, user.pk, user.pk)
)
print(u'[ZEP-25] : PM send to {}'.format(user))

Expand Down

0 comments on commit fb73363

Please sign in to comment.