# HG changeset patch # User nishanth # Date 1271026393 -19800 # Node ID c52d170969f0eb8403a738238db7cd200e4d896c # Parent e29ecb7819e78c6058d05520ce609b383005efcd quite a few changes. modified models and feedback views . diff -r e29ecb7819e7 -r c52d170969f0 feedback/forms.py --- a/feedback/forms.py Mon Apr 12 02:57:25 2010 +0530 +++ b/feedback/forms.py Mon Apr 12 04:23:13 2010 +0530 @@ -8,5 +8,5 @@ class Meta: model = Feedback - exclude = ['user_ip'] + exclude = ['user_ip', 'event', 'day'] diff -r e29ecb7819e7 -r c52d170969f0 feedback/models.py --- a/feedback/models.py Mon Apr 12 02:57:25 2010 +0530 +++ b/feedback/models.py Mon Apr 12 04:23:13 2010 +0530 @@ -45,6 +45,7 @@ user_ip = models.CharField(max_length=15) event = models.ForeignKey(Event) + day = models.PositiveIntegerField(default=1) range_of_topics = models.CharField(max_length=1, choices=TOPICS_CHOICES, verbose_name="Range of topics covered", blank=True) diff -r e29ecb7819e7 -r c52d170969f0 feedback/site/urls.py --- a/feedback/site/urls.py Mon Apr 12 02:57:25 2010 +0530 +++ b/feedback/site/urls.py Mon Apr 12 04:23:13 2010 +0530 @@ -3,6 +3,6 @@ from workshop.feedback import views as feed_views urlpatterns = patterns('', - ('^submit$', feed_views.submit_feedback), - ('^list$', feed_views.list_feedbacks), + ('^submit/(\w+)$', feed_views.submit_feedback), + ('^list/(\w+)$', feed_views.list_feedbacks), ) diff -r e29ecb7819e7 -r c52d170969f0 feedback/views.py --- a/feedback/views.py Mon Apr 12 02:57:25 2010 +0530 +++ b/feedback/views.py Mon Apr 12 04:23:13 2010 +0530 @@ -5,7 +5,7 @@ from django.http import HttpResponse -def submit_feedback(request): +def submit_feedback(request, event_key): """ see if the ip address has already submitted a feedback. if not, collect the feedback. """ @@ -24,7 +24,7 @@ form = FeedbackForm() return render_to_response('feedback.html',{'form':form}) -def list_feedbacks(request): +def list_feedbacks(request, event_key): """ print a list of all the feedbacks collected. """ diff -r e29ecb7819e7 -r c52d170969f0 reg/models.py --- a/reg/models.py Mon Apr 12 02:57:25 2010 +0530 +++ b/reg/models.py Mon Apr 12 04:23:13 2010 +0530 @@ -8,6 +8,16 @@ ('F', 'Faculty'), ('P', 'Professional')) +FEEDBACK_CHOICES = (('0': 'Closed'), + ('1': 'Day 1 Open'), + ('2': 'Day 2 Open'), + ) + +QUIZ_CHOICES = (('00': 'Closed'), + ('11': 'Day1 Quiz1 Open'), + ('12': 'Day1 Quiz2 Open'), + ('21': 'Day2 Quiz1 Open'), + ) class Profile(models.Model): """ A model to hold extra information about the user. @@ -34,9 +44,10 @@ stop_date = models.DateField(help_text="YYYY-MM-DD") attendees = models.ManyToManyField(User, related_name="%(class)s_attendees") organizers = models.ManyToManyField(User, related_name="%(class)s_organizers") - - feedback_open = models.BooleanField() - quiz_open = models.BooleanField() + + registration_status = models.BooleanField(default=False) + feedback_status = models.CharField(max_length=1, choices=FEEDBACK_CHOICES, default='0') + quiz_status = models.CharField(max_length=2, choices=QUIZ_CHOICES, default='00') def __unicode__(self): diff -r e29ecb7819e7 -r c52d170969f0 reg/views.py --- a/reg/views.py Mon Apr 12 02:57:25 2010 +0530 +++ b/reg/views.py Mon Apr 12 04:23:13 2010 +0530 @@ -20,7 +20,6 @@ events = Event.objects.all()[:10] - def user_login(request): """ get the user object from e-mail and then check for password. """ @@ -107,14 +106,21 @@ """ user = request.user - is_guest = False if user.is_authenticated() else True try: event = Event.objects.get(key__iexact=key) except Event.DoesNotExist: - return HttpResponse("F off") + return redirect("/reg") + + is_guest = False if user.is_authenticated() else True + is_attendee = True if user in event.attendees.all() else False + is_org = True if user in event.organizers.all() else False - return HttpResponse(str(event)) + context = {'is_guest': is_guest, + 'is_attendee': is_attendee, + 'is_org': is_org, + } + return render_to_response('view_event.html', context) def reset_password(request): """ check for the existance of e-mail. diff -r e29ecb7819e7 -r c52d170969f0 view_event.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/view_event.html Mon Apr 12 04:23:13 2010 +0530 @@ -0,0 +1,4 @@ +{% extends "base.html" %} +{% block content %} + +{% endblock %}