Skip to content

Commit

Permalink
Allow tours to be named
Browse files Browse the repository at this point in the history
  • Loading branch information
cnorthwood committed Jul 28, 2011
1 parent a566f98 commit 0d6c542
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 0 deletions.
102 changes: 102 additions & 0 deletions molly/apps/tours/migrations/0002_auto__add_field_tour_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# encoding: 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 field 'Tour.name'
db.add_column('tours_tour', 'name', self.gf('django.db.models.fields.TextField')(default='Unnamed tour'), keep_default=False)

# Removing M2M table for field stops on 'Tour'
db.delete_table('tours_tour_stops')


def backwards(self, orm):

# Deleting field 'Tour.name'
db.delete_column('tours_tour', 'name')

# Adding M2M table for field stops on 'Tour'
db.create_table('tours_tour_stops', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('tour', models.ForeignKey(orm['tours.tour'], null=False)),
('entity', models.ForeignKey(orm['places.entity'], null=False))
))
db.create_unique('tours_tour_stops', ['tour_id', 'entity_id'])


models = {
'places.entity': {
'Meta': {'object_name': 'Entity'},
'_identifiers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['places.Identifier']", 'symmetrical': 'False'}),
'_metadata': ('django.db.models.fields.TextField', [], {'default': "'{}'"}),
'absolute_url': ('django.db.models.fields.TextField', [], {}),
'all_types': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'entities'", 'blank': 'True', 'to': "orm['places.EntityType']"}),
'all_types_completion': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'entities_completion'", 'blank': 'True', 'to': "orm['places.EntityType']"}),
'geometry': ('django.contrib.gis.db.models.fields.GeometryField', [], {'null': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['places.EntityGroup']", 'symmetrical': 'False'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'identifier_scheme': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
'identifier_value': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'is_stack': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_sublocation': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'location': ('django.contrib.gis.db.models.fields.PointField', [], {'null': 'True'}),
'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['places.Entity']", 'null': 'True'}),
'primary_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['places.EntityType']", 'null': 'True'}),
'source': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['places.Source']"})
},
'places.entitygroup': {
'Meta': {'object_name': 'EntityGroup'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ref_code': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'source': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['places.Source']"})
},
'places.entitytype': {
'Meta': {'object_name': 'EntityType'},
'category': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['places.EntityTypeCategory']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'note': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'show_in_category_list': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'show_in_nearby_list': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}),
'subtype_of': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'subtypes'", 'blank': 'True', 'to': "orm['places.EntityType']"}),
'subtype_of_completion': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'subtypes_completion'", 'blank': 'True', 'to': "orm['places.EntityType']"})
},
'places.entitytypecategory': {
'Meta': {'object_name': 'EntityTypeCategory'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.TextField', [], {})
},
'places.identifier': {
'Meta': {'object_name': 'Identifier'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'scheme': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
'value': ('django.db.models.fields.CharField', [], {'max_length': '256'})
},
'places.source': {
'Meta': {'object_name': 'Source'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'last_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'module_name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'tours.stopontour': {
'Meta': {'ordering': "['order']", 'object_name': 'StopOnTour'},
'entity': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['places.Entity']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'order': ('django.db.models.fields.IntegerField', [], {}),
'tour': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['tours.Tour']"})
},
'tours.tour': {
'Meta': {'object_name': 'Tour'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.TextField', [], {}),
'stops': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['places.Entity']", 'through': "orm['tours.StopOnTour']", 'symmetrical': 'False'})
}
}

complete_apps = ['tours']
1 change: 1 addition & 0 deletions molly/apps/tours/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

class Tour(models.Model):

name = models.TextField()
stops = models.ManyToManyField(Entity, through='StopOnTour')

def get_absolute_url(self):
Expand Down

0 comments on commit 0d6c542

Please sign in to comment.