models - siggame/discuss GitHub Wiki
Models define the schemas of our database. It's so wonderful.
Refer to the Django documentation on Models for defining the actual Model classes (hint: they all inherit from models.Model).
Discuss Models
User
- Don't define a new User model.
- We'll just use the built-in django.contrib.auth.models.User
Team
- GitHub ID - An integer
- Name - A string that is less than 200 characters in length
- Org Name - A string that is less than 200 characters in length
Post
- User - A foreign key to User
- Team - A foreign key to Team
- Title - A Char field limited to 250 characters
- Content - A text field with no size limit
- Created - A Date/Time field that is set automatically on creation (
auto_add_now
)
Comment
- User - A foreign key to User
- Post - A foreign key to Post
- Content - A text field with no size limit
- Created - A Date/Time field that is set automatically on creation (
auto_add_now
)
PostVote
- User - A foreign key to User
- Post - A foreign key to Post
- Vote - A character field of size 1 - a choice between ("U" and "D") for up and down
CommentVote
- User - A foreign key to User
- Comment - A foreign key to Comment
- Vote - A character field of size 1 - a choice between ("U" and "D") for up and down