Skip to content

Instantly share code, notes, and snippets.

@zain
Created September 29, 2014 22:58
Show Gist options
  • Save zain/6786b105c39ad633f830 to your computer and use it in GitHub Desktop.
Save zain/6786b105c39ad633f830 to your computer and use it in GitHub Desktop.
diff --git a/inventory/migrations/0001_initial.py b/inventory/migrations/0001_initial.py
index 690d9dd..34c87a3 100644
--- a/inventory/migrations/0001_initial.py
+++ b/inventory/migrations/0001_initial.py
@@ -27,7 +27,7 @@ class Migration(migrations.Migration):
('photos', djorm_pgarray.fields.TextArrayField(dbtype='text', default=[], max_length=32)),
('seo_title', models.CharField(db_column='seotitle', max_length=255)),
('title', models.CharField(max_length=255)),
- ('address_id', models.IntegerField(blank=True, null=True, db_column='addressid')),
+ ('address', models.ForeignKey(blank=True, null=True, to='locations.Address', db_column='addressid')),
('city', models.ForeignKey(blank=True, null=True, to='locations.City', db_column='cityid')),
('cross_street_id', models.IntegerField(blank=True, null=True, db_column='crossstreetid')),
('is_partner', models.BooleanField(default=False, db_column='ispartner')),
@@ -146,7 +146,7 @@ class Migration(migrations.Migration):
('email', models.ForeignKey(null=True, db_column='emailid', blank=True, to='inventory.Email')),
('feature_rule', models.ForeignKey(null=True, db_column='featureruleid', blank=True, to='inventory.FeatureRule')),
('feed', models.ForeignKey(db_column='feedid', to='inventory.Feed')),
- ('address_id', models.IntegerField(blank=True, null=True, db_column='addressid')),
+ ('address', models.ForeignKey(blank=True, null=True, to='locations.Address', db_column='addressid')),
('city', models.ForeignKey(blank=True, null=True, to='locations.City', db_column='cityid')),
('cross_street_id', models.IntegerField(blank=True, null=True, db_column='crossstreetid')),
('is_partner', models.BooleanField(default=False, db_column='ispartner')),
diff --git a/inventory/models/building.py b/inventory/models/building.py
index d585b82..c1a26fe 100644
--- a/inventory/models/building.py
+++ b/inventory/models/building.py
@@ -26,14 +26,13 @@ class Building(ExpireMixin, models.Model):
allow_cats = models.BooleanField(default=False, db_column='allowcats')
allow_dogs = models.BooleanField(default=False, db_column='allowdogs')
+ address = models.IntegerField('locations.Address', db_column='addressid', blank=True, null=True)
city = models.ForeignKey('locations.City', db_column='cityid', blank=True, null=True)
neighborhood = models.ForeignKey('locations.Neighborhood', db_column='neighborhoodid', blank=True, null=True)
# the following are columns that are foreignkey references to tables that exist in the existing database but
# don't have models associated with them (because we don't need them yet). when the models are created, these
# can be replaced with ForeignKey fields.
-
- address_id = models.IntegerField(db_column='addressid', blank=True, null=True)
cross_street_id = models.IntegerField(db_column='crossstreetid', blank=True, null=True)
region_id = models.IntegerField(db_column='regionid', blank=True, null=True)
diff --git a/inventory/models/listing.py b/inventory/models/listing.py
index 96bed87..5681346 100644
--- a/inventory/models/listing.py
+++ b/inventory/models/listing.py
@@ -34,14 +34,13 @@ class Listing(ExpireMixin, models.Model):
allow_cats = models.BooleanField(default=False, db_column='allowcats')
allow_dogs = models.BooleanField(default=False, db_column='allowdogs')
+ address = models.IntegerField('locations.Address', db_column='addressid', blank=True, null=True)
city = models.ForeignKey('locations.City', db_column='cityid', blank=True, null=True)
neighborhood = models.ForeignKey('locations.Neighborhood', db_column='neighborhoodid', blank=True, null=True)
# the following are columns that are foreignkey references to tables that exist in the existing database but
# don't have models associated with them (because we don't need them yet). when the models are created, these
# can be replaced with ForeignKey fields.
-
- address_id = models.IntegerField(db_column='addressid', blank=True, null=True)
cross_street_id = models.IntegerField(db_column='crossstreetid', blank=True, null=True)
region_id = models.IntegerField(db_column='regionid', blank=True, null=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment