added an app called event and created the event model.
authornishanth
Mon, 19 Apr 2010 22:06:51 +0530
changeset 4 e3b8a3ae3857
parent 3 abfecc652a16
child 5 9a671f3eb24c
added an app called event and created the event model.
event/__init__.py
event/models.py
event/tests.py
event/views.py
feedback/forms.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/event/models.py	Mon Apr 19 22:06:51 2010 +0530
@@ -0,0 +1,11 @@
+from django.db import models
+
+class Event(models.Model):
+    """ An event.
+    """
+
+    title = models.CharField(max_length=200)
+    start_date = models.DateField()
+    stop_date = models.DateField()
+    feedback_status = models.CharField(max_length=1, default='0')
+    quiz_status = models.CharField(max_length=2, default='00')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/event/tests.py	Mon Apr 19 22:06:51 2010 +0530
@@ -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
+"""}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/event/views.py	Mon Apr 19 22:06:51 2010 +0530
@@ -0,0 +1,1 @@
+# Create your views here.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/feedback/forms.py	Mon Apr 19 22:06:51 2010 +0530
@@ -0,0 +1,15 @@
+from django import forms
+
+from ws_app.feedback.models import Feedback
+
+class FeedbackForm(forms.ModelForm):
+    """ A form to collect the feedback.
+    """
+
+    class Meta:
+        model = Feedback
+        exclude = [ 'event', 'day']
+
+    def clean_comments(self):
+        comments = self.cleaned_data['comments']
+        return comments.strip()