Merge branch 'master' into julian
authorStephen Burrows <stephen.r.burrows@gmail.com>
Wed, 9 Feb 2011 15:30:58 +0000 (10:30 -0500)
committerStephen Burrows <stephen.r.burrows@gmail.com>
Wed, 9 Feb 2011 15:30:58 +0000 (10:30 -0500)
contrib/julian/__init__.py [new file with mode: 0644]
contrib/julian/models.py [new file with mode: 0644]
contrib/julian/tests.py [new file with mode: 0644]
contrib/julian/views.py [new file with mode: 0644]

diff --git a/contrib/julian/__init__.py b/contrib/julian/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/contrib/julian/models.py b/contrib/julian/models.py
new file mode 100644 (file)
index 0000000..33c4d51
--- /dev/null
@@ -0,0 +1,29 @@
+from django.db import models
+from django.contrib.auth.models import User
+from philo.models.base import Tag, Entity, Titled
+import datetime
+
+if not hasattr(settings, 'PHILO_LOCATION_MODULE'):
+       class Location(Entity, Titled):
+               slug = models.SlugField(max_length=255, unique=True)
+
+# Needs to be organised in a sensical order.
+class Event(Entity, Titled):
+       description = models.TextField()
+       start_time = models.DateTimeField(blank=True, null=True)
+       end_time = models.DateTimeField(blank=True, null=True)
+       is_all_day_event = models.BooleanField(default=False)
+       location = models.ForeignKey(getattr(settings, 'PHILO_LOCATION_MODULE', Location), related_name='events', blank=True, null=True)
+       tags = models.ManyToManyField(Tag, blank=True, null=True)
+       parent_event = models.ForeignKey(Event, blank=True, null=True)                          # To handle series' of events.
+       user = models.ForeignKey(getattr(settings, 'PHILO_PERSON_MODULE', User))        # Should this be optional?
+       url = models.URLField(blank=True, null=True)
+       attachment = models.FileField(upload_to='events/attachments/%Y/%m/%d', blank=True, null=True)
+       image = models.ImageField(upload_to='events/images/%Y/%m/%d', blank=True, null=True)
+
+
+class Calendar(Entity, Titled):
+       slug = models.SlugField(max_length=255, unique=True)
+       events = models.ManyToManyField(Event, related_name='calendars')
+       
+# NOTES: Only let start time be blank if it has child events with times.
\ No newline at end of file
diff --git a/contrib/julian/tests.py b/contrib/julian/tests.py
new file mode 100644 (file)
index 0000000..2247054
--- /dev/null
@@ -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/contrib/julian/views.py b/contrib/julian/views.py
new file mode 100644 (file)
index 0000000..60f00ef
--- /dev/null
@@ -0,0 +1 @@
+# Create your views here.