Commit 09d202f9 authored by Ben Waters's avatar Ben Waters
Browse files

Added Time Stamped Model

parent b7174125
from django.contrib import admin
# Register your models here.
from django.db import models
# Create your models here.
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
from django.db import models
from model_utils.models import TimeStampedModel
import datetime
class BaseModel(models.Model):
last_modified = models.DateTimeField('Last Modified', auto_now=True)
class Category(BaseModel):
class Category(TimeStampedModel):
name = models.CharField(max_length=100)
class Facility(BaseModel):
class Facility(TimeStampedModel):
"""Represents a dining location on campus."""
name = models.CharField(max_length=100)
category = models.ForeignKey('Category', related_name="facilities", null=True, blank=True)
......@@ -50,7 +47,7 @@ class Facility(BaseModel):
class Schedule(BaseModel):
class Schedule(TimeStampedModel):
Contains opening and closing times for each day in a week.
......@@ -79,7 +76,7 @@ class Schedule(BaseModel):
class OpenTime(BaseModel):
class OpenTime(TimeStampedModel):
"""Represents a period time when a Facility is open"""
schedule = models.ForeignKey('Schedule', related_name='open_times')
start_day = models.IntegerField() # 0-6, Monday == 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment