Created
October 29, 2016 17:49
-
-
Save codeboy101/38e61471a8c764f9461048daa58dbc60 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| from django.utils import timezone | |
| from datetime import date | |
| from django.contrib.auth.models import User | |
| class Story(models.Model): | |
| title = models.CharField(max_length=75) | |
| body = models.TextField() | |
| author = models.CharField(default="",max_length=75) | |
| pub_date = models.DateTimeField(default=timezone.now) | |
| total_votes = models.IntegerField(default=0) | |
| def __str__(self): | |
| return self.title | |
| class Vote(models.Model): | |
| story = models.ForeignKey(Story,null=True) | |
| voter = models.ForeignKey(User,null=True) | |
| has_voted = models.BooleanField(default=False) | |
| vote_cast = models.IntegerField(default=0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment