Skip to content

Instantly share code, notes, and snippets.

@devStepsize
Created April 12, 2016 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devStepsize/d46e232b0a27526c72b74ec56dd670d3 to your computer and use it in GitHub Desktop.
Save devStepsize/d46e232b0a27526c72b74ec56dd670d3 to your computer and use it in GitHub Desktop.
Example Django models class
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