Commit 5ae7cb7b authored by Daniel Bond's avatar Daniel Bond

set up Restaurant and Schedule classes

parent e5ca1e28
No preview for this file type
Django==1.4.1
South==0.7.6
argparse==1.2.1
distribute==0.6.28
wsgiref==0.1.2
from django.contrib import admin
from website.models import Restaurant, Schedule
admin.site.register(Restaurant)
admin.site.register(Schedule)
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Restaurant'
db.create_table('website_restaurant', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
('mainSchedule', self.gf('django.db.models.fields.related.ForeignKey')(related_name='restaurant_main', to=orm['website.Schedule'])),
))
db.send_create_signal('website', ['Restaurant'])
# Adding M2M table for field specialSchedules on 'Restaurant'
db.create_table('website_restaurant_specialSchedules', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('restaurant', models.ForeignKey(orm['website.restaurant'], null=False)),
('schedule', models.ForeignKey(orm['website.schedule'], null=False))
))
db.create_unique('website_restaurant_specialSchedules', ['restaurant_id', 'schedule_id'])
# Adding model 'Schedule'
db.create_table('website_schedule', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('dateValidStart', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
('dateValidEnd', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
('monOpen', self.gf('django.db.models.fields.TimeField')(null=True, blank=True)),
('monClose', self.gf('django.db.models.fields.TimeField')(null=True, blank=True)),
('tueOpen', self.gf('django.db.models.fields.TimeField')(null=True, blank=True)),
('tueClose', self.gf('django.db.models.fields.TimeField')(null=True, blank=True)),
('wedOpen', self.gf('django.db.models.fields.TimeField')(null=True, blank=True)),
('wedClose', self.gf('django.db.models.fields.TimeField')(null=True, blank=True)),
('thuOpen', self.gf('django.db.models.fields.TimeField')(null=True, blank=True)),
('thuClose', self.gf('django.db.models.fields.TimeField')(null=True, blank=True)),
('friOpen', self.gf('django.db.models.fields.TimeField')(null=True, blank=True)),
('friClose', self.gf('django.db.models.fields.TimeField')(null=True, blank=True)),
('satOpen', self.gf('django.db.models.fields.TimeField')(null=True, blank=True)),
('satClose', self.gf('django.db.models.fields.TimeField')(null=True, blank=True)),
('sunOpen', self.gf('django.db.models.fields.TimeField')(null=True, blank=True)),
('sunClose', self.gf('django.db.models.fields.TimeField')(null=True, blank=True)),
))
db.send_create_signal('website', ['Schedule'])
def backwards(self, orm):
# Deleting model 'Restaurant'
db.delete_table('website_restaurant')
# Removing M2M table for field specialSchedules on 'Restaurant'
db.delete_table('website_restaurant_specialSchedules')
# Deleting model 'Schedule'
db.delete_table('website_schedule')
models = {
'website.restaurant': {
'Meta': {'object_name': 'Restaurant'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'mainSchedule': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'restaurant_main'", 'to': "orm['website.Schedule']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'specialSchedules': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'restaurant_special'", 'symmetrical': 'False', 'to': "orm['website.Schedule']"})
},
'website.schedule': {
'Meta': {'object_name': 'Schedule'},
'dateValidEnd': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
'dateValidStart': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
'friClose': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),
'friOpen': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'monClose': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),
'monOpen': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),
'satClose': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),
'satOpen': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),
'sunClose': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),
'sunOpen': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),
'thuClose': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),
'thuOpen': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),
'tueClose': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),
'tueOpen': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),
'wedClose': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),
'wedOpen': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'})
}
}
complete_apps = ['website']
\ No newline at end of file
from django.db import models
class Restaurant(models.Model):
name = models.CharField(max_length = 100)
mainSchedule = models.ForeignKey('Schedule', related_name = 'restaurant_main')
specialSchedules = models.ManyToManyField('Schedule', related_name = 'restaurant_special')
class Schedule(models.Model):
dateValidStart = models.DateField(null = True, blank = True)
dateValidEnd = models.DateField(null = True, blank = True)
monOpen = models.TimeField(null = True, blank = True)
monClose = models.TimeField(null = True, blank = True)
tueOpen = models.TimeField(null = True, blank = True)
tueClose = models.TimeField(null = True, blank = True)
wedOpen = models.TimeField(null = True, blank = True)
wedClose = models.TimeField(null = True, blank = True)
thuOpen = models.TimeField(null = True, blank = True)
thuClose = models.TimeField(null = True, blank = True)
friOpen = models.TimeField(null = True, blank = True)
friClose = models.TimeField(null = True, blank = True)
satOpen = models.TimeField(null = True, blank = True)
satClose = models.TimeField(null = True, blank = True)
sunOpen = models.TimeField(null = True, blank = True)
sunClose = models.TimeField(null = True, blank = True)
......@@ -119,6 +119,8 @@ INSTALLED_APPS = (
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
'django.contrib.admindocs',
'south',
'website',
)
# A sample logging configuration. The only tangible logging
......
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