dr.botzo, the IRC bot with Django integration.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

47 lines
1.4 KiB

from django.db import models
class LogEntry(models.Model):
id = models.IntegerField(primary_key=True)
key = models.CharField(max_length=255)
delta = models.IntegerField(choices=((1, u'++'), (-1, u'--')))
who = models.CharField(max_length=30)
userhost = models.CharField(max_length=512)
timestamp = models.DateTimeField(db_column='karmatime')
def __unicode__(self):
return "%s given %s by %s on %s" % (self.key, self.delta,
self.who, self.timestamp)
class Meta:
db_table = 'karma_log'
ordering = ['timestamp']
managed = False
class User(models.Model):
who = models.CharField(max_length=30, primary_key=True)
pos = models.IntegerField()
neg = models.IntegerField()
def _get_total(self):
return self.pos + self.neg
total = property(_get_total)
def __unicode__(self):
return "Karma User %s (%s/%s)" % (self.who, self,pos, self.neg)
class Meta:
db_table = 'karma_users'
ordering = ['who']
managed = False
class Value(models.Model):
key = models.CharField(max_length=255, primary_key=True)
value = models.IntegerField()
def __unicode__(self):
return "Karma Value %s (%s)" % (self.key, self.value)
class Meta:
db_table = 'karma_values'
ordering = ['value']
managed = False