Mercurial > public > sg101
annotate gpp/forums/management/commands/update_forum_stats.py @ 463:452835f4429f
Fixing #225; for some reason MySQL finds the user 'John' when searching for 'John ' (note trailing space). This doesn't happen on SQLite. This causes a NoReverseMatch when searching for 'John ' in the member search. The solution is to call strip() on the form field contents in the clean_username() method of the search form.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 09 Jul 2011 02:00:48 +0000 |
parents | e10fa0d8e7ad |
children |
rev | line source |
---|---|
bgneal@395 | 1 """ |
bgneal@395 | 2 update_forum_stats.py - A management command to calculate and update the |
bgneal@395 | 3 cache with the forum statistics. These are done out of the request / |
bgneal@395 | 4 response cycle because doing a count on the Post table is expensive |
bgneal@395 | 5 under MySQL and InnoDb. |
bgneal@395 | 6 |
bgneal@395 | 7 """ |
bgneal@395 | 8 from django.core.management.base import NoArgsCommand, CommandError |
bgneal@395 | 9 |
bgneal@395 | 10 from forums.stats import update_stats |
bgneal@395 | 11 |
bgneal@395 | 12 |
bgneal@395 | 13 class Command(NoArgsCommand): |
bgneal@395 | 14 help = "Calculates and updates the cache with forums statistics" |
bgneal@395 | 15 |
bgneal@395 | 16 def handle_noargs(self, **opts): |
bgneal@395 | 17 update_stats() |