view core/models.py @ 917:0365fdbb4d78

Fix app conflict with messages. Django's messages app label conflicts with our messages app. We can't easily rename our label as that will make us rename database tables. Since our app came first we'll just customize Django messages label. For Django 1.7.7 upgrade.
author Brian Neal <bgneal@gmail.com>
date Mon, 06 Apr 2015 20:02:25 -0500
parents 2f5779e9d8f8
children
line wrap: on
line source
"""
This file contains the core Models used in gpp
"""
from django.db import models


class Statistic(models.Model):
    """
    This model keeps track of site statistics. Currently, the only statistic
    is the maximum number of users online. This stat is computed by a mgmt.
    command that is run on a cron job to peek at the previous two models.
    """
    max_users = models.IntegerField()
    max_users_date = models.DateTimeField()
    max_anon_users = models.IntegerField()
    max_anon_users_date = models.DateTimeField()

    def __unicode__(self):
        return u'%d users on %s' % (self.max_users,
                self.max_users_date.strftime('%Y-%m-%d %H:%M:%S'))