Index: trunk/tools/editor_trends/wikilytics/manage.py |
— | — | @@ -0,0 +1,11 @@ |
| 2 | +#!/usr/bin/env python
|
| 3 | +from django.core.management import execute_manager
|
| 4 | +try:
|
| 5 | + import settings # Assumed to be in the same directory.
|
| 6 | +except ImportError:
|
| 7 | + import sys
|
| 8 | + sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
|
| 9 | + sys.exit(1)
|
| 10 | +
|
| 11 | +if __name__ == "__main__":
|
| 12 | + execute_manager(settings)
|
Index: trunk/tools/editor_trends/wikilytics/requirements.txt |
— | — | @@ -0,0 +1,3 @@ |
| 2 | +djangotoolbox
|
| 3 | +django-nonrel
|
| 4 | +django-mongodb-engine
|
Index: trunk/tools/editor_trends/wikilytics/__init__.py |
Index: trunk/tools/editor_trends/wikilytics/api/views.py |
— | — | @@ -0,0 +1 @@ |
| 2 | +# Create your views here.
|
Index: trunk/tools/editor_trends/wikilytics/api/__init__.py |
Index: trunk/tools/editor_trends/wikilytics/api/tests.py |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +"""
|
| 3 | +This file demonstrates two different styles of tests (one doctest and one
|
| 4 | +unittest). These will both pass when you run "manage.py test".
|
| 5 | +
|
| 6 | +Replace these with more appropriate tests for your application.
|
| 7 | +"""
|
| 8 | +
|
| 9 | +from django.test import TestCase
|
| 10 | +
|
| 11 | +class SimpleTest(TestCase):
|
| 12 | + def test_basic_addition(self):
|
| 13 | + """
|
| 14 | + Tests that 1 + 1 always equals 2.
|
| 15 | + """
|
| 16 | + self.failUnlessEqual(1 + 1, 2)
|
| 17 | +
|
| 18 | +__test__ = {"doctest": """
|
| 19 | +Another way to test that 1 + 1 is equal to 2.
|
| 20 | +
|
| 21 | +>>> 1 + 1 == 2
|
| 22 | +True
|
| 23 | +"""}
|
| 24 | +
|
Index: trunk/tools/editor_trends/wikilytics/api/models.py |
— | — | @@ -0,0 +1,30 @@ |
| 2 | +from django.db import models
|
| 3 | +from django.contrib import databrowse
|
| 4 | +from django.contrib import admin
|
| 5 | +from djangotoolbox.fields import DictField, ListField
|
| 6 | +
|
| 7 | +
|
| 8 | +class Editor(models.Model):
|
| 9 | + username = models.CharField(max_length=64)
|
| 10 | + editor = models.IntegerField()
|
| 11 | + first_edit = models.DateField()
|
| 12 | + final_edit = models.DateField()
|
| 13 | + new_wikipedian = models.DateField()
|
| 14 | + monthly_edits = DictField()
|
| 15 | + edit_count = models.IntegerField()
|
| 16 | + articles_by_year = DictField()
|
| 17 | + edits_by_year = DictField()
|
| 18 | + edits = ListField()
|
| 19 | +
|
| 20 | + class Meta:
|
| 21 | + db_table = 'editors_dataset'
|
| 22 | +
|
| 23 | + def __str__(self):
|
| 24 | + return '%s, total edits: %s' % (self.username.encode('utf-8'), self.edit_count)
|
| 25 | +
|
| 26 | +
|
| 27 | +class EditorAdmin(admin.ModelAdmin):
|
| 28 | + pass
|
| 29 | +
|
| 30 | +admin.site.register(Editor, EditorAdmin)
|
| 31 | +databrowse.site.register(Editor)
|
Index: trunk/tools/editor_trends/wikilytics/urls.py |
— | — | @@ -0,0 +1,18 @@ |
| 2 | +from django.conf.urls.defaults import *
|
| 3 | +from django.contrib import databrowse
|
| 4 | +
|
| 5 | +
|
| 6 | +# Uncomment the next two lines to enable the admin:
|
| 7 | +from django.contrib import admin
|
| 8 | +admin.autodiscover()
|
| 9 | +
|
| 10 | +urlpatterns = patterns('',
|
| 11 | + # Example:
|
| 12 | + # (r'^wikilytics/', include('wikilytics.foo.urls')),
|
| 13 | + (r'^databrowse/(.*)', databrowse.site.root),
|
| 14 | + # Uncomment the admin/doc line below to enable admin documentation:
|
| 15 | + # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
| 16 | +
|
| 17 | + # Uncomment the next line to enable the admin:
|
| 18 | + (r'^admin/', include(admin.site.urls)),
|
| 19 | +)
|