gremmie@1: """ bgneal@37: This file contains the core Models used in gpp gremmie@1: """ bgneal@239: import datetime bgneal@239: bgneal@227: from django.db import models bgneal@239: from django.contrib.auth.models import User gremmie@1: bgneal@227: bgneal@239: class Statistic(models.Model): bgneal@239: """ bgneal@239: This model keeps track of site statistics. Currently, the only statistic bgneal@239: is the maximum number of users online. This stat is computed by a mgmt. bgneal@239: command that is run on a cron job to peek at the previous two models. bgneal@239: """ bgneal@239: max_users = models.IntegerField() bgneal@239: max_users_date = models.DateTimeField() bgneal@239: max_anon_users = models.IntegerField() bgneal@239: max_anon_users_date = models.DateTimeField() bgneal@239: bgneal@239: def __unicode__(self): bgneal@423: return u'%d users on %s' % (self.max_users, bgneal@239: self.max_users_date.strftime('%Y-%m-%d %H:%M:%S')) bgneal@239: