from django.db import models

# Create your models here.
class Question(models.Model):
    question_text = models.CharField(max_length = 500) 
    pub_date = models.DateTimeField(auto_now_add = True)

    def __str__(self):
        return self.question_text

class Choice(models.Model):
    question = models.ForeignKey(Question, on_delete = models.CASCADE)
    choice_text = models.CharField( max_length = 200)
    votes = models.IntegerField(default = 0)

    def __str__(self):
        return self.choice_text

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f8a5d278-a840-433b-b431-9499d9dd9debn%40googlegroups.com.

Reply via email to