summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/__init__.py0
-rw-r--r--main/admin.py4
-rw-r--r--main/models.py24
-rw-r--r--main/signals.py0
-rw-r--r--main/tests.py23
-rw-r--r--main/urls.py4
-rw-r--r--main/views.py13
7 files changed, 68 insertions, 0 deletions
diff --git a/main/__init__.py b/main/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/main/__init__.py
diff --git a/main/admin.py b/main/admin.py
new file mode 100644
index 0000000..093f769
--- /dev/null
+++ b/main/admin.py
@@ -0,0 +1,4 @@
+from main.models import Tag
+from django.contrib import admin
+
+admin.site.register(Tag)
diff --git a/main/models.py b/main/models.py
new file mode 100644
index 0000000..8ecddec
--- /dev/null
+++ b/main/models.py
@@ -0,0 +1,24 @@
+from django.db import models
+
+class Tag(models.Model):
+ name = models.CharField(primary_key=True, max_length=200)
+
+ def __unicode__(self):
+ return self.name
+
+class Activity(models.Model):
+ ACTCATEGORY_CHOICES = (
+ ('blog', 'Blog post'),
+ ('project', 'Project page'),
+ ('link', 'Link'),
+ )
+ ACTTYPE_CHOICES = (
+ ('add', 'Add'),
+ ('edit', 'Edit'),
+ ('delete', 'Delete'),
+ )
+ date = models.DateTimeField(auto_now=True)
+ actcategory = models.CharField(max_length=100, choices=ACTCATEGORY_CHOICES)
+ actdescription = models.CharField(max_length=500)
+ acttype = models.CharField(max_length=6)
+ objpk = models.CharField(max_length=300, null=True)
diff --git a/main/signals.py b/main/signals.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/main/signals.py
diff --git a/main/tests.py b/main/tests.py
new file mode 100644
index 0000000..2247054
--- /dev/null
+++ b/main/tests.py
@@ -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
+"""}
+
diff --git a/main/urls.py b/main/urls.py
new file mode 100644
index 0000000..9f861b5
--- /dev/null
+++ b/main/urls.py
@@ -0,0 +1,4 @@
+from django.conf.urls.defaults import *
+
+urlpatterns = patterns('main.views',
+ (r'^$', 'index'))
diff --git a/main/views.py b/main/views.py
new file mode 100644
index 0000000..91e20dd
--- /dev/null
+++ b/main/views.py
@@ -0,0 +1,13 @@
+from django.http import HttpResponse
+from django.shortcuts import render_to_response
+from django.template import Context, loader
+from main.models import Activity
+
+def index(request):
+ activity_list = Activity.objects.all().order_by("-date")[:5]
+ t = loader.get_template("home.html")
+ c = Context({
+ "activitylist": activity_list,
+ })
+
+ return HttpResponse(t.render(c))