Created
April 12, 2016 15:52
-
-
Save devStepsize/d46e232b0a27526c72b74ec56dd670d3 to your computer and use it in GitHub Desktop.
Example Django models class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class Question(models.Model): | |
question_text = models.CharField(max_length=200) | |
pub_date = models.DateTimeField('date published') | |
class Choice(models.Model): | |
question = models.ForeignKey(Question, on_delete=models.CASCADE) | |
choice_text = models.CharField(max_length=200) | |
votes = models.IntegerField(default=0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment