From c48133bd1cf88692f8766c6fb25f531aa93ada0f Mon Sep 17 00:00:00 2001 From: Bryan Date: Fri, 17 Jan 2014 00:30:40 -0500 Subject: [PATCH] School is deprecated inside Note. --- .../0011_auto__chg_field_course_school.py | 79 +++++++++++++++++++ karmaworld/apps/courses/models.py | 2 +- 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 karmaworld/apps/courses/migrations/0011_auto__chg_field_course_school.py diff --git a/karmaworld/apps/courses/migrations/0011_auto__chg_field_course_school.py b/karmaworld/apps/courses/migrations/0011_auto__chg_field_course_school.py new file mode 100644 index 0000000..3d6416f --- /dev/null +++ b/karmaworld/apps/courses/migrations/0011_auto__chg_field_course_school.py @@ -0,0 +1,79 @@ +# -*- 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): + + # Changing field 'Course.school' + db.alter_column(u'courses_course', 'school_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['courses.School'], null=True)) + + def backwards(self, orm): + + # Changing field 'Course.school' + db.alter_column(u'courses_course', 'school_id', self.gf('django.db.models.fields.related.ForeignKey')(default=1, to=orm['courses.School'])) + + models = { + u'courses.course': { + 'Meta': {'ordering': "['-file_count', 'school', 'name']", 'unique_together': "(('name', 'department'),)", 'object_name': 'Course'}, + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'department': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['courses.Department']", 'null': 'True', 'blank': 'True'}), + 'desc': ('django.db.models.fields.TextField', [], {'max_length': '511', 'null': 'True', 'blank': 'True'}), + 'file_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'flags': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'instructor_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'instructor_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'school': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['courses.School']", 'null': 'True', 'blank': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '150', 'null': 'True'}), + 'updated_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.utcnow'}), + 'url': ('django.db.models.fields.URLField', [], {'max_length': '511', 'null': 'True', 'blank': 'True'}) + }, + u'courses.department': { + 'Meta': {'unique_together': "(('name', 'school'),)", 'object_name': 'Department'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'school': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['courses.School']"}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '150', 'null': 'True'}), + 'url': ('django.db.models.fields.URLField', [], {'max_length': '511', 'null': 'True', 'blank': 'True'}) + }, + u'courses.professor': { + 'Meta': {'unique_together': "(('name', 'email'),)", 'object_name': 'Professor'}, + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + }, + u'courses.professoraffiliation': { + 'Meta': {'unique_together': "(('professor', 'department'),)", 'object_name': 'ProfessorAffiliation'}, + 'department': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['courses.Department']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'professor': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['courses.Professor']"}) + }, + u'courses.professortaught': { + 'Meta': {'unique_together': "(('professor', 'course'),)", 'object_name': 'ProfessorTaught'}, + 'course': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['courses.Course']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'professor': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['courses.Professor']"}) + }, + u'courses.school': { + 'Meta': {'ordering': "['-file_count', '-priority', 'name']", 'object_name': 'School'}, + 'alias': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'facebook_id': ('django.db.models.fields.BigIntegerField', [], {'null': 'True', 'blank': 'True'}), + 'file_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'hashtag': ('django.db.models.fields.CharField', [], {'max_length': '16', 'unique': 'True', 'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'location': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'priority': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '150', 'null': 'True'}), + 'url': ('django.db.models.fields.URLField', [], {'max_length': '511', 'blank': 'True'}), + 'usde_id': ('django.db.models.fields.BigIntegerField', [], {'unique': 'True', 'null': 'True', 'blank': 'True'}) + } + } + + complete_apps = ['courses'] \ No newline at end of file diff --git a/karmaworld/apps/courses/models.py b/karmaworld/apps/courses/models.py index 5419dc4..7f12342 100644 --- a/karmaworld/apps/courses/models.py +++ b/karmaworld/apps/courses/models.py @@ -210,7 +210,7 @@ class Course(models.Model): department = models.ForeignKey(Department, blank=True, null=True) # school is an appendix: the kind that gets swollen and should be removed # (vistigial) - school = models.ForeignKey(School) + school = models.ForeignKey(School, null=True, blank=True) file_count = models.IntegerField(default=0) desc = models.TextField(max_length=511, blank=True, null=True) -- 2.25.1