feedback/models.py
author nishanth
Thu, 15 Apr 2010 12:36:21 +0530
changeset 39 61d558a69b0d
parent 12 f57b0a7f24d9
child 53 0a4b2c49f718
permissions -rw-r--r--
implemented listing of feedbacks.

from django.db import models
from django.contrib.auth.models import User

from workshop.reg.models import Event

TOPICS_CHOICES = (('1', 'Very relevant'),
                  ('2', 'Relevant'),
                  ('3', 'Somewhat relevant'),
                  ('4', 'Not relevant'))

DEPTH_CHOICES = (('1', 'Too detailed'),
                 ('2', 'Detailed'),
                 ('3', 'Not enough detail'),
                 ('4', 'Poor detail'))

METHODOLOGY_CHOICES = (('1', 'Extremely effective'),
                       ('2', 'Effective'),
                       ('3', 'Not very effective'),
                       ('4', 'Ineffective'))

PACE_CHOICES = (('1', 'Too fast'),
                ('2', 'Fast'),
                ('3', 'Just right'),
                ('4', 'Slow'),
                ('5', 'Too slow'))

APPLICABILITY_CHOICES = (('1', 'I can use most of it immediately'),
                         ('2', 'I can use it somewhat immediately'),
                         ('3', 'I cannot use it immediately'),
                         ('4', 'I might never use it'))

PROBLEMS_CHOICES = (('1', 'Very intersting'),
                    ('2', 'Interesting'),
                    ('3', 'Somewhat interesting'),
                    ('4', 'Not interesting'))

EXERCISES_CHOICES = (('1', 'Very instructive'),
                     ('2', 'Instructive'),
                     ('3', 'Somewhat instructive'),
                     ('4', 'Not instructive'))

class Feedback(models.Model):
    """ A table to hold the feedbacks.
    """

    user_ip = models.CharField(max_length=15)
    event = models.ForeignKey(Event, related_name="%(class)s")
    day = models.CharField(max_length=1, default='1')

    topics = models.CharField(max_length=1, choices=TOPICS_CHOICES,
                              verbose_name="Range of topics covered", blank=True)
    depth = models.CharField(max_length=1, choices=DEPTH_CHOICES, 
                             verbose_name="Depth of coverage", blank=True)
    methodology = models.CharField(max_length=1, choices=METHODOLOGY_CHOICES,
                                   verbose_name="Effectiveness of methodology", blank=True)
    pace = models.CharField(max_length=1, choices=PACE_CHOICES,
                            verbose_name="Pace of coverage", blank=True)
    applicability = models.CharField(max_length=1, choices=APPLICABILITY_CHOICES, blank=True)
    problems = models.CharField(max_length=1, choices=PROBLEMS_CHOICES,
                                verbose_name="Choice of problems", blank=True)
    exercises = models.CharField(max_length=1, choices=EXERCISES_CHOICES,
                                 verbose_name="Choice of exercises", blank=True)
    comments = models.TextField(verbose_name="General comments", blank=True)

    def __unicode__(self):
        
        return unicode(self.event.title)