adding karma 'app'
This commit is contained in:
parent
da313800b9
commit
154eb9753f
0
botweb/karma/__init__.py
Normal file
0
botweb/karma/__init__.py
Normal file
33
botweb/karma/models.py
Normal file
33
botweb/karma/models.py
Normal file
@ -0,0 +1,33 @@
|
||||
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')
|
||||
|
||||
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()
|
||||
|
||||
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()
|
||||
|
||||
class Meta:
|
||||
db_table = 'karma_values'
|
||||
ordering = ['value']
|
||||
managed = False
|
23
botweb/karma/tests.py
Normal file
23
botweb/karma/tests.py
Normal file
@ -0,0 +1,23 @@
|
||||
"""
|
||||
This file demonstrates two different styles of tests (one doctest and one
|
||||
unittest). These will both pass when you run "manage.py test".
|
||||
|
||||
Replace these with more appropriate tests for your application.
|
||||
"""
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
class SimpleTest(TestCase):
|
||||
def test_basic_addition(self):
|
||||
"""
|
||||
Tests that 1 + 1 always equals 2.
|
||||
"""
|
||||
self.failUnlessEqual(1 + 1, 2)
|
||||
|
||||
__test__ = {"doctest": """
|
||||
Another way to test that 1 + 1 is equal to 2.
|
||||
|
||||
>>> 1 + 1 == 2
|
||||
True
|
||||
"""}
|
||||
|
1
botweb/karma/views.py
Normal file
1
botweb/karma/views.py
Normal file
@ -0,0 +1 @@
|
||||
# Create your views here.
|
@ -6,7 +6,7 @@ DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
ADMINS = (
|
||||
# ('Your Name', 'your_email@domain.com'),
|
||||
('Mike Bloy', 'mike@bloy.org'),
|
||||
)
|
||||
|
||||
MANAGERS = ADMINS
|
||||
@ -96,7 +96,7 @@ INSTALLED_APPS = (
|
||||
#'django.contrib.sites',
|
||||
#'django.contrib.messages',
|
||||
# Uncomment the next line to enable the admin:
|
||||
# 'django.contrib.admin',
|
||||
#'django.contrib.admin',
|
||||
# Uncomment the next line to enable admin documentation:
|
||||
# 'django.contrib.admindocs',
|
||||
'karma',
|
||||
|
@ -4,7 +4,11 @@ from django.conf.urls.defaults import *
|
||||
# from django.contrib import admin
|
||||
# admin.autodiscover()
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
(r'^karma/$', 'karma.views.index'),
|
||||
(r'^karma/givers/$', 'karma.views.givers'),
|
||||
(r'^karma/stats/$', 'karma.views.stats'),
|
||||
# Example:
|
||||
# (r'^botweb/', include('botweb.foo.urls')),
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user