added venue field in event model and corresponding forms and views.
authornishanth
Thu, 15 Apr 2010 14:38:48 +0530
changeset 43 757d1da69255
parent 42 0f926874a695
child 44 7d748db0c7c3
added venue field in event model and corresponding forms and views.
reg/events.py
reg/forms.py
reg/models.py
reg/views.py
templates/view_event.html
--- a/reg/events.py	Thu Apr 15 14:15:44 2010 +0530
+++ b/reg/events.py	Thu Apr 15 14:38:48 2010 +0530
@@ -43,7 +43,7 @@
 
     print "http://localhost:8000/reg/activate/%s"%user.get_profile().activation_key
 
-def create_event(title, description, start_date, stop_date, created_by=None):
+def create_event(title, description, start_date, stop_date, venue, created_by=None):
     """ make an event and save it.
     """
 
@@ -52,6 +52,7 @@
     new_event.description = description
     new_event.start_date = start_date
     new_event.stop_date = stop_date
+    new_event.venue = venue
     new_event.save()
     if created_by:
         new_event.organizers.add(created_by)
--- a/reg/forms.py	Thu Apr 15 14:15:44 2010 +0530
+++ b/reg/forms.py	Thu Apr 15 14:38:48 2010 +0530
@@ -101,7 +101,7 @@
 
     class Meta:
         model = Event
-        fields = ['title', 'description', 'start_date', 'stop_date']
+        fields = ['title', 'description', 'start_date', 'stop_date', 'venue']
 
     def clean_start_date(self):
         """ see if the start date is greater than today or not.
--- a/reg/models.py	Thu Apr 15 14:15:44 2010 +0530
+++ b/reg/models.py	Thu Apr 15 14:38:48 2010 +0530
@@ -42,6 +42,9 @@
     description = models.TextField()
     start_date = models.DateField(verbose_name="Start Date")
     stop_date = models.DateField(verbose_name="End Date")
+    venue = models.CharField(max_length=100, help_text="College name and city")
+
+    feedback_submitted_by = models.ManyToManyField(User, related_name="%(class)s_feedback_submitted_by")
     attendees = models.ManyToManyField(User, related_name="%(class)s_attendees")
     organizers = models.ManyToManyField(User, related_name="%(class)s_organizers")
     
--- a/reg/views.py	Thu Apr 15 14:15:44 2010 +0530
+++ b/reg/views.py	Thu Apr 15 14:38:48 2010 +0530
@@ -146,6 +146,7 @@
                                                     description=data['description'],
                                                     start_date=data['start_date'],
                                                     stop_date=data['stop_date'],
+                                                    venue=data['venue'],
                                                     created_by=user,
                                                    )
                 event_url = "/reg/event/view/%s"%(new_event.key)
--- a/templates/view_event.html	Thu Apr 15 14:15:44 2010 +0530
+++ b/templates/view_event.html	Thu Apr 15 14:38:48 2010 +0530
@@ -3,7 +3,8 @@
 	<h3>{{ event.title }}</h3>
 	<b>Description:</b><br />
 	{{event.description|linebreaksbr}}<br /><br />
-	<b>Duration:</b> {{event.start_date|date:"d M Y"}} to {{event.stop_date|date:"d M Y"}}<br /><br />
+	<b>Duration:</b> {{event.start_date|date:"d M Y"}} to {{event.stop_date|date:"d M Y"}}<br />
+	<b>Venue:</b> {{event.venue}} <br /><br />
 	
 	{% if user.is_authenticated %}
 		{% if event.registration_is_open %}