def process_tasks(self):
        Task = apps.get_model("tasks", "Task")
        qs = Task.objects.all()

        for item in iter_queryset(qs):
            description = self.replace_matches(item.description)
            Task.objects.filter(pk=item.pk).update(description=description)
 def handle(self, *args, **options):
     qs = HistoryChangeNotification.objects.all()
     for change_notification in iter_queryset(qs, itersize=100):
         try:
             send_sync_notifications(change_notification.pk)
         except HistoryChangeNotification.DoesNotExist:
             pass
    def process_wiki(self):
        WikiPage = apps.get_model("wiki", "WikiPage")
        qs = WikiPage.objects.all()

        for item in iter_queryset(qs):
            content = self.replace_matches(item.content)
            WikiPage.objects.filter(pk=item.pk).update(content=content)
    def process_issues(self):
        Issue = apps.get_model("issues", "Issue")
        qs = Issue.objects.all()

        for item in iter_queryset(qs):
            description = self.replace_matches(item.description)
            Issue.objects.filter(pk=item.pk).update(description=description)
    def process_userstories(self):
        UserStory = apps.get_model("userstories", "UserStory")
        qs = UserStory.objects.all()

        for item in iter_queryset(qs):
            description = self.replace_matches(item.description)
            UserStory.objects.filter(pk=item.pk).update(description=description)
Exemple #6
0
    def process_wiki(self):
        WikiPage = apps.get_model("wiki", "WikiPage")
        qs = WikiPage.objects.all()

        for item in iter_queryset(qs):
            content = self.replace_matches(item.content)
            WikiPage.objects.filter(pk=item.pk).update(content=content)
Exemple #7
0
    def process_issues(self):
        Issue = apps.get_model("issues", "Issue")
        qs = Issue.objects.all()

        for item in iter_queryset(qs):
            description = self.replace_matches(item.description)
            Issue.objects.filter(pk=item.pk).update(description=description)
Exemple #8
0
    def process_tasks(self):
        Task = apps.get_model("tasks", "Task")
        qs = Task.objects.all()

        for item in iter_queryset(qs):
            description = self.replace_matches(item.description)
            Task.objects.filter(pk=item.pk).update(description=description)
Exemple #9
0
 def handle(self, *args, **options):
     qs = HistoryChangeNotification.objects.all()
     for change_notification in iter_queryset(qs, itersize=100):
         try:
             send_sync_notifications(change_notification.pk)
         except HistoryChangeNotification.DoesNotExist:
             pass
Exemple #10
0
    def process_userstories(self):
        UserStory = apps.get_model("userstories", "UserStory")
        qs = UserStory.objects.all()

        for item in iter_queryset(qs):
            description = self.replace_matches(item.description)
            UserStory.objects.filter(pk=item.pk).update(
                description=description)
Exemple #11
0
    def process_history(self):
        HistoryEntry = apps.get_model("history", "HistoryEntry")
        qs = HistoryEntry.objects.all()

        for item in iter_queryset(qs):
            comment = self.replace_matches(item.comment)
            comment_html = self.replace_matches(item.comment_html)
            HistoryEntry.objects.filter(pk=item.pk).update(comment=comment, comment_html=comment_html)
Exemple #12
0
    def process_history(self):
        HistoryEntry = apps.get_model("history", "HistoryEntry")
        qs = HistoryEntry.objects.all()

        for item in iter_queryset(qs):
            comment = self.replace_matches(item.comment)
            comment_html = self.replace_matches(item.comment_html)
            HistoryEntry.objects.filter(pk=item.pk).update(
                comment=comment, comment_html=comment_html)
Exemple #13
0
def send_bulk_email():
    with advisory_lock("send-notifications-command", wait=False) as acquired:
        if acquired:
            qs = HistoryChangeNotification.objects.all().order_by("-id")
            for change_notification in iter_queryset(qs, itersize=100):
                try:
                    send_sync_notifications(change_notification.pk)
                except HistoryChangeNotification.DoesNotExist:
                    pass
 def handle(self, *args, **options):
     with advisory_lock("send-notifications-command", wait=False) as acquired:
         if acquired:
             qs = HistoryChangeNotification.objects.all()
             for change_notification in iter_queryset(qs, itersize=100):
                 try:
                     send_sync_notifications(change_notification.pk)
                 except HistoryChangeNotification.DoesNotExist:
                     pass
         else:
             print("Other process already running")
 def handle(self, *args, **options):
     with advisory_lock("send-notifications-command",
                        wait=False) as acquired:
         if acquired:
             qs = HistoryChangeNotification.objects.all().order_by("-id")
             for change_notification in iter_queryset(qs, itersize=100):
                 try:
                     send_sync_notifications(change_notification.pk)
                 except HistoryChangeNotification.DoesNotExist:
                     pass
         else:
             print("Other process already running")
Exemple #16
0
    def move_user_photo(self):
        print("Moving all user photos to new location")

        User = apps.get_model("users", "User")
        qs = User.objects.all()

        for item in iter_queryset(qs):
            try:
                with transaction.atomic():
                    old_file = item.photo
                    item.photo = File(old_file)
                    item.save()
            except FileNotFoundError:
                pass
Exemple #17
0
    def move_attachments(self):
        print("Moving all attachments to new location")

        Attachment = apps.get_model("attachments", "Attachment")
        qs = Attachment.objects.all()

        for item in iter_queryset(qs):
            try:
                with transaction.atomic():
                    old_file = item.attached_file
                    item.attached_file = File(old_file)
                    item.save()
            except FileNotFoundError:
                item.delete()
Exemple #18
0
    def move_attachments(self):
        print("Moving all attachments to new location")

        Attachment = apps.get_model("attachments", "Attachment")
        qs = Attachment.objects.all()

        for item in iter_queryset(qs):
            try:
                with transaction.atomic():
                    old_file = item.attached_file
                    item.attached_file = File(old_file)
                    item.save()
            except FileNotFoundError:
                item.delete()
Exemple #19
0
    def move_user_photo(self):
        print("Moving all user photos to new location")

        User = apps.get_model("users", "User")
        qs = User.objects.all()

        for item in iter_queryset(qs):
            try:
                with transaction.atomic():
                    old_file = item.photo
                    item.photo = File(old_file)
                    item.save()
            except FileNotFoundError:
                pass