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