From 7f2ed459e92b56c28a8ca50292e95a42987544d4 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 26 Apr 2012 11:53:49 -0500 Subject: Remove now-unused NullCharField It would be straightforward if we just needed to remove the field class definition, but we also need to update all migrations that referenced it so we don't have problems starting and migrating from scratch. Signed-off-by: Dan McGee --- mirrors/migrations/0009_auto__chg_field_mirrorurl_country.py | 6 +++--- .../migrations/0010_auto__add_field_mirrorprotocol_default.py | 2 +- mirrors/migrations/0011_adjust_protocol_defaults.py | 2 +- mirrors/migrations/0012_auto__add_on_delete_attribute.py | 2 +- mirrors/migrations/0013_rename_country_fields.py | 2 +- mirrors/migrations/0014_add_country_code_fields.py | 2 +- mirrors/migrations/0015_assign_country_codes.py | 2 +- ..._field_mirror_country_old__del_field_mirrorurl_country_old.py | 2 +- mirrors/models.py | 9 +-------- 9 files changed, 11 insertions(+), 18 deletions(-) diff --git a/mirrors/migrations/0009_auto__chg_field_mirrorurl_country.py b/mirrors/migrations/0009_auto__chg_field_mirrorurl_country.py index 941ecfbb..bca6b6fb 100644 --- a/mirrors/migrations/0009_auto__chg_field_mirrorurl_country.py +++ b/mirrors/migrations/0009_auto__chg_field_mirrorurl_country.py @@ -7,11 +7,11 @@ from django.db import models class Migration(SchemaMigration): def forwards(self, orm): - db.alter_column('mirrors_mirrorurl', 'country', self.gf('mirrors.models.NullCharField')(max_length=255, null=True)) + pass def backwards(self, orm): - db.alter_column('mirrors_mirrorurl', 'country', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) + pass models = { 'mirrors.mirror': { @@ -53,7 +53,7 @@ class Migration(SchemaMigration): }, 'mirrors.mirrorurl': { 'Meta': {'object_name': 'MirrorUrl'}, - 'country': ('mirrors.models.NullCharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'country': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), 'has_ipv4': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'has_ipv6': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), diff --git a/mirrors/migrations/0010_auto__add_field_mirrorprotocol_default.py b/mirrors/migrations/0010_auto__add_field_mirrorprotocol_default.py index 6868cb25..d30c78c7 100644 --- a/mirrors/migrations/0010_auto__add_field_mirrorprotocol_default.py +++ b/mirrors/migrations/0010_auto__add_field_mirrorprotocol_default.py @@ -53,7 +53,7 @@ class Migration(SchemaMigration): }, 'mirrors.mirrorurl': { 'Meta': {'object_name': 'MirrorUrl'}, - 'country': ('mirrors.models.NullCharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'country': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), 'has_ipv4': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'has_ipv6': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), diff --git a/mirrors/migrations/0011_adjust_protocol_defaults.py b/mirrors/migrations/0011_adjust_protocol_defaults.py index 0118de67..a5ffafb4 100644 --- a/mirrors/migrations/0011_adjust_protocol_defaults.py +++ b/mirrors/migrations/0011_adjust_protocol_defaults.py @@ -54,7 +54,7 @@ class Migration(DataMigration): }, 'mirrors.mirrorurl': { 'Meta': {'object_name': 'MirrorUrl'}, - 'country': ('mirrors.models.NullCharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'country': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), 'has_ipv4': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'has_ipv6': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), diff --git a/mirrors/migrations/0012_auto__add_on_delete_attribute.py b/mirrors/migrations/0012_auto__add_on_delete_attribute.py index 3990d466..f81fe0ae 100644 --- a/mirrors/migrations/0012_auto__add_on_delete_attribute.py +++ b/mirrors/migrations/0012_auto__add_on_delete_attribute.py @@ -55,7 +55,7 @@ class Migration(SchemaMigration): }, 'mirrors.mirrorurl': { 'Meta': {'object_name': 'MirrorUrl'}, - 'country': ('mirrors.models.NullCharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'country': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), 'has_ipv4': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'has_ipv6': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), diff --git a/mirrors/migrations/0013_rename_country_fields.py b/mirrors/migrations/0013_rename_country_fields.py index 96bb732b..8a9bc34a 100644 --- a/mirrors/migrations/0013_rename_country_fields.py +++ b/mirrors/migrations/0013_rename_country_fields.py @@ -55,7 +55,7 @@ class Migration(SchemaMigration): }, 'mirrors.mirrorurl': { 'Meta': {'object_name': 'MirrorUrl'}, - 'country_old': ('mirrors.models.NullCharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'country_old': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), 'has_ipv4': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'has_ipv6': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), diff --git a/mirrors/migrations/0014_add_country_code_fields.py b/mirrors/migrations/0014_add_country_code_fields.py index 6248fc7e..010194d7 100644 --- a/mirrors/migrations/0014_add_country_code_fields.py +++ b/mirrors/migrations/0014_add_country_code_fields.py @@ -61,7 +61,7 @@ class Migration(SchemaMigration): 'mirrors.mirrorurl': { 'Meta': {'object_name': 'MirrorUrl'}, 'country': ('django_countries.fields.CountryField', [], {'max_length': '2', 'blank': 'True'}), - 'country_old': ('mirrors.models.NullCharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'country_old': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), 'has_ipv4': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'has_ipv6': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), diff --git a/mirrors/migrations/0015_assign_country_codes.py b/mirrors/migrations/0015_assign_country_codes.py index 1d16ada3..c1b0f969 100644 --- a/mirrors/migrations/0015_assign_country_codes.py +++ b/mirrors/migrations/0015_assign_country_codes.py @@ -79,7 +79,7 @@ class Migration(DataMigration): 'mirrors.mirrorurl': { 'Meta': {'object_name': 'MirrorUrl'}, 'country': ('django_countries.fields.CountryField', [], {'max_length': '2', 'blank': 'True'}), - 'country_old': ('mirrors.models.NullCharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'country_old': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), 'has_ipv4': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'has_ipv6': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), diff --git a/mirrors/migrations/0016_auto__del_field_mirror_country_old__del_field_mirrorurl_country_old.py b/mirrors/migrations/0016_auto__del_field_mirror_country_old__del_field_mirrorurl_country_old.py index ae917ec0..b296d7ae 100644 --- a/mirrors/migrations/0016_auto__del_field_mirror_country_old__del_field_mirrorurl_country_old.py +++ b/mirrors/migrations/0016_auto__del_field_mirror_country_old__del_field_mirrorurl_country_old.py @@ -19,7 +19,7 @@ class Migration(SchemaMigration): self.gf('django.db.models.fields.CharField')(default='Any', max_length=255, db_index=True), keep_default=False) db.add_column('mirrors_mirrorurl', 'country_old', - self.gf('mirrors.models.NullCharField')(blank=True, max_length=255, null=True, db_index=True), + self.gf('django.db.models.fields.CharField')(blank=True, max_length=255, null=True, db_index=True), keep_default=False) models = { diff --git a/mirrors/models.py b/mirrors/models.py index c23622fa..19437610 100644 --- a/mirrors/models.py +++ b/mirrors/models.py @@ -5,14 +5,6 @@ from django.db import models from django.core.exceptions import ValidationError from django_countries import CountryField -class NullCharField(models.CharField): - description = "String (up to %(max_length)s), NULL if value is empty" - _south_introspects = True - - def get_prep_value(self, value): - if value == '': - return None - return self.to_python(value) TIER_CHOICES = ( (0, 'Tier 0'), @@ -21,6 +13,7 @@ TIER_CHOICES = ( (-1, 'Untiered'), ) + class Mirror(models.Model): name = models.CharField(max_length=255, unique=True) tier = models.SmallIntegerField(default=2, choices=TIER_CHOICES) -- cgit v1.2.3