]> git.openstreetmap.org Git - osqa.git/blob - forum/management/commands/create_subscriptions.py
Make RequestHolder thread-safe
[osqa.git] / forum / management / commands / create_subscriptions.py
1 from forum.models import User, SubscriptionSettings, QuestionSubscription
2 from django.core.management.base import NoArgsCommand
3
4 class Command(NoArgsCommand):
5     def handle_noargs(self, **options):
6         users = User.objects.all()
7         for u in users:
8             s = SubscriptionSettings(user=u)
9             s.save()
10
11             user_questions = u.questions.all()
12
13             for q in user_questions:
14                 sub = QuestionSubscription(user=u, question=q)
15                 sub.save()