From b7062c8ddad975f3a9ca688ae3fc775749f058a8 Mon Sep 17 00:00:00 2001 From: Adarnof Date: Wed, 7 Jun 2017 23:12:07 -0400 Subject: [PATCH] Remove legacy HRApplication models. Closes #655 --- .../migrations/0004_remove_legacy_models.py | 64 +++++++++++++++++++ hrapplications/models.py | 37 ----------- 2 files changed, 64 insertions(+), 37 deletions(-) create mode 100644 hrapplications/migrations/0004_remove_legacy_models.py diff --git a/hrapplications/migrations/0004_remove_legacy_models.py b/hrapplications/migrations/0004_remove_legacy_models.py new file mode 100644 index 00000000..a78b3c90 --- /dev/null +++ b/hrapplications/migrations/0004_remove_legacy_models.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.2 on 2017-06-08 02:54 +from __future__ import unicode_literals + +from django.db import migrations + + +def delete_permissions(apps, schema_editor): + HRApplication = apps.get_model('hrapplications', 'HRApplication') + HRApplicationComment = apps.get_model('hrapplications', 'HRApplicationComment') + ContentType = apps.get_model('contenttypes', 'ContentType') + Permission = apps.get_model('auth', 'Permission') + ct1 = ContentType.objects.get_for_model(HRApplication) + ct2 = ContentType.objects.get_for_model(HRApplicationComment) + Permission.objects.filter(content_type__in=[ct1, ct2]).delete() + + +class Migration(migrations.Migration): + + dependencies = [ + ('hrapplications', '0003_sorted_questions'), + ] + + operations = [ + migrations.RemoveField( + model_name='hrapplication', + name='corp', + ), + migrations.RemoveField( + model_name='hrapplication', + name='reviewer_character', + ), + migrations.RemoveField( + model_name='hrapplication', + name='reviewer_inprogress_character', + ), + migrations.RemoveField( + model_name='hrapplication', + name='reviewer_user', + ), + migrations.RemoveField( + model_name='hrapplication', + name='user', + ), + migrations.RemoveField( + model_name='hrapplicationcomment', + name='application', + ), + migrations.RemoveField( + model_name='hrapplicationcomment', + name='commenter_character', + ), + migrations.RemoveField( + model_name='hrapplicationcomment', + name='commenter_user', + ), + migrations.RunPython(delete_permissions, migrations.RunPython.noop), + migrations.DeleteModel( + name='HRApplication', + ), + migrations.DeleteModel( + name='HRApplicationComment', + ), + ] diff --git a/hrapplications/models.py b/hrapplications/models.py index b21ef771..b9ff2407 100755 --- a/hrapplications/models.py +++ b/hrapplications/models.py @@ -83,40 +83,3 @@ class ApplicationComment(models.Model): def __str__(self): return str(self.user) + " comment on " + str(self.application) - - -################ -# Legacy Models -################ -@python_2_unicode_compatible -class HRApplication(models.Model): - character_name = models.CharField(max_length=254, default="") - full_api_id = models.CharField(max_length=254, default="") - full_api_key = models.CharField(max_length=254, default="") - is_a_spi = models.CharField(max_length=254, default="") - about = models.TextField(default="") - extra = models.TextField(default="") - - corp = models.ForeignKey(EveCorporationInfo) - user = models.ForeignKey(User) - - approved_denied = models.NullBooleanField(blank=True, null=True) - reviewer_user = models.ForeignKey(User, blank=True, null=True, related_name="review_user") - reviewer_character = models.ForeignKey(EveCharacter, blank=True, null=True) - reviewer_inprogress_character = models.ForeignKey(EveCharacter, blank=True, null=True, - related_name="inprogress_character") - - def __str__(self): - return self.character_name + " - Application" - - -@python_2_unicode_compatible -class HRApplicationComment(models.Model): - created_on = models.DateTimeField(auto_now_add=True, null=True) - comment = models.CharField(max_length=254, default="") - application = models.ForeignKey(HRApplication) - commenter_user = models.ForeignKey(User) - commenter_character = models.ForeignKey(EveCharacter) - - def __str__(self): - return str(self.application.character_name) + " - Comment"