models.py 747 Bytes
Newer Older
Jason D Yeomans's avatar
Jason D Yeomans committed
1
from django.db import models
2 3 4
from housing.models import User, Room, Class
from autoslug import AutoSlugField
from model_utils.models import TimeStampedModel
Jason D Yeomans's avatar
Jason D Yeomans committed
5 6

# Create your models here.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
class Major(TimeStampedModel):
    major_name = models.CharField(max_length = 30)

class Student(TimeStampedModel):
    user = models.OneToOneField(User)
    # Django user includes a username, password, email, first name, and last name
    room = models.OneToOneField(Room)
    clas = models.OneToOneField(Class)
    major = models.OneToOneField(Major)
    # major = models.

    # social media accounts

    slug = AutoSlugField(populate_from='user', unique=True)

    def __str__(self):              # __unicode__ on Python 2
        return self.user.username