~widelands-dev/widelands-website/update_beautifulsoup4

« back to all changes in this revision

Viewing changes to pybb/management/commands/pybb_resave_post.py

  • Committer: Holger Rapp
  • Date: 2009-02-25 16:55:36 UTC
  • Revision ID: sirver@kallisto.local-20090225165536-3abfhjx8qsgtzyru
- Added my hacked version of pybb. Remerging new versions is very difficult at this point :(

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from optparse import make_option
 
2
 
 
3
from django.core.management.base import BaseCommand, CommandError
 
4
from django.contrib.auth.models import User
 
5
 
 
6
from pybb.models import Post
 
7
from pybb import settings as app_settings
 
8
 
 
9
class Command(BaseCommand):
 
10
    help = 'Resave all posts.'
 
11
 
 
12
    def handle(self, *args, **kwargs):
 
13
        app_settings.DISABLE_NOTIFICATION = True
 
14
 
 
15
        for count, post in enumerate(Post.objects.all()):
 
16
            if count and not count % 1000:
 
17
                print count
 
18
            post.save()