From: Radek Czajka Date: Tue, 19 Feb 2013 09:45:53 +0000 (+0100) Subject: allow longer slugs X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/308d11aa1622eea40bfc572564f28be42e262944?ds=inline allow longer slugs --- diff --git a/catalogue/migrations/0011_auto__chg_field_lesson_xml_file__chg_field_lesson_student_pdf__chg_fie.py b/catalogue/migrations/0011_auto__chg_field_lesson_xml_file__chg_field_lesson_student_pdf__chg_fie.py new file mode 100644 index 0000000..5963f2b --- /dev/null +++ b/catalogue/migrations/0011_auto__chg_field_lesson_xml_file__chg_field_lesson_student_pdf__chg_fie.py @@ -0,0 +1,127 @@ +# -*- 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 'Lesson.xml_file' + db.alter_column('catalogue_lesson', 'xml_file', self.gf('django.db.models.fields.files.FileField')(max_length=255, null=True)) + + # Changing field 'Lesson.student_pdf' + db.alter_column('catalogue_lesson', 'student_pdf', self.gf('django.db.models.fields.files.FileField')(max_length=255, null=True)) + + # Changing field 'Lesson.student_package' + db.alter_column('catalogue_lesson', 'student_package', self.gf('django.db.models.fields.files.FileField')(max_length=255, null=True)) + + # Changing field 'Lesson.package' + db.alter_column('catalogue_lesson', 'package', self.gf('django.db.models.fields.files.FileField')(max_length=255, null=True)) + + # Changing field 'Lesson.html_file' + db.alter_column('catalogue_lesson', 'html_file', self.gf('django.db.models.fields.files.FileField')(max_length=255, null=True)) + + # Changing field 'Lesson.pdf' + db.alter_column('catalogue_lesson', 'pdf', self.gf('django.db.models.fields.files.FileField')(max_length=255, null=True)) + + # Changing field 'Lesson.slug' + db.alter_column('catalogue_lesson', 'slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=255)) + + # Changing field 'Section.xml_file' + db.alter_column('catalogue_section', 'xml_file', self.gf('django.db.models.fields.files.FileField')(max_length=255, null=True)) + + # Changing field 'Section.slug' + db.alter_column('catalogue_section', 'slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=255)) + + def backwards(self, orm): + + # Changing field 'Lesson.xml_file' + db.alter_column('catalogue_lesson', 'xml_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True)) + + # Changing field 'Lesson.student_pdf' + db.alter_column('catalogue_lesson', 'student_pdf', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True)) + + # Changing field 'Lesson.student_package' + db.alter_column('catalogue_lesson', 'student_package', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True)) + + # Changing field 'Lesson.package' + db.alter_column('catalogue_lesson', 'package', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True)) + + # Changing field 'Lesson.html_file' + db.alter_column('catalogue_lesson', 'html_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True)) + + # Changing field 'Lesson.pdf' + db.alter_column('catalogue_lesson', 'pdf', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True)) + + # Changing field 'Lesson.slug' + db.alter_column('catalogue_lesson', 'slug', self.gf('django.db.models.fields.SlugField')(max_length=50, unique=True)) + + # Changing field 'Section.xml_file' + db.alter_column('catalogue_section', 'xml_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True)) + + # Changing field 'Section.slug' + db.alter_column('catalogue_section', 'slug', self.gf('django.db.models.fields.SlugField')(max_length=50, unique=True)) + + models = { + 'catalogue.attachment': { + 'Meta': {'ordering': "['slug', 'ext']", 'unique_together': "(['lesson', 'slug', 'ext'],)", 'object_name': 'Attachment'}, + 'ext': ('django.db.models.fields.CharField', [], {'max_length': '15'}), + 'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'lesson': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Lesson']"}), + 'slug': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + }, + 'catalogue.lesson': { + 'Meta': {'ordering': "['section', 'level', 'order']", 'object_name': 'Lesson'}, + 'curriculum_courses': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['curriculum.CurriculumCourse']", 'symmetrical': 'False'}), + 'dc': ('jsonfield.fields.JSONField', [], {'default': "'{}'"}), + 'html_file': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'level': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['curriculum.Level']"}), + 'order': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), + 'package': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'pdf': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'section': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Section']", 'null': 'True', 'blank': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}), + 'student_package': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'student_pdf': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}), + 'xml_file': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}) + }, + 'catalogue.part': { + 'Meta': {'object_name': 'Part'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'lesson': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Lesson']"}), + 'pdf': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'student_pdf': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}) + }, + 'catalogue.section': { + 'Meta': {'ordering': "['order']", 'object_name': 'Section'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}), + 'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'xml_file': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}) + }, + 'curriculum.curriculumcourse': { + 'Meta': {'ordering': "['slug']", 'object_name': 'CurriculumCourse'}, + 'accusative': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'slug': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + }, + 'curriculum.level': { + 'Meta': {'ordering': "['order']", 'object_name': 'Level'}, + 'group': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'slug': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + } + } + + complete_apps = ['catalogue'] \ No newline at end of file diff --git a/catalogue/models.py b/catalogue/models.py index c684ab5..ea1063e 100644 --- a/catalogue/models.py +++ b/catalogue/models.py @@ -7,10 +7,10 @@ from curriculum.models import Level, Curriculum, CurriculumCourse class Section(models.Model): title = models.CharField(max_length=255, unique=True) - slug = models.SlugField(unique=True) + slug = models.SlugField(max_length=255, unique=True) order = models.IntegerField() xml_file = models.FileField(upload_to="catalogue/section/xml", - null=True, blank=True) + null=True, blank=True, max_length=255) class Meta: ordering = ['order'] @@ -67,24 +67,24 @@ class Lesson(models.Model): section = models.ForeignKey(Section, null=True, blank=True) level = models.ForeignKey(Level) title = models.CharField(max_length=255) - slug = models.SlugField(unique=True) + slug = models.SlugField(max_length=255, unique=True) type = models.CharField(max_length=15, db_index=True) order = models.IntegerField(db_index=True) dc = JSONField(default='{}') curriculum_courses = models.ManyToManyField(CurriculumCourse) xml_file = models.FileField(upload_to="catalogue/lesson/xml", - null=True, blank=True) # FIXME: slug in paths + null=True, blank=True, max_length=255) html_file = models.FileField(upload_to="catalogue/lesson/html", - null=True, blank=True) + null=True, blank=True, max_length=255) package = models.FileField(upload_to="catalogue/lesson/pack", - null=True, blank=True) + null=True, blank=True, max_length=255) student_package = models.FileField(upload_to="catalogue/lesson/student_pack", - null=True, blank=True) + null=True, blank=True, max_length=255) pdf = models.FileField(upload_to="catalogue/lesson/pdf", - null=True, blank=True) + null=True, blank=True, max_length=255) student_pdf = models.FileField(upload_to="catalogue/lesson/student_pdf", - null=True, blank=True) + null=True, blank=True, max_length=255) class Meta: ordering = ['section', 'level', 'order']