1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

refactor migration

This commit is contained in:
John Anderson
2020-06-29 04:22:01 -04:00
parent 3777fbccc3
commit 1681dbfa39
2 changed files with 14 additions and 23 deletions

View File

@ -13,11 +13,15 @@ def convert_job_results(apps, schema_editor):
"""
Convert ReportResult objects to JobResult objects
"""
from django.contrib.contenttypes.management import create_contenttypes
from extras.choices import JobResultStatusChoices
ReportResult = apps.get_model('extras', 'ReportResult')
JobResult = apps.get_model('extras', 'JobResult')
ContentType = apps.get_model('contenttypes', 'ContentType')
app_config = apps.get_app_config('extras')
app_config.models_module = app_config.models_module or True
create_contenttypes(app_config)
report_content_type = ContentType.objects.get(app_label='extras', model='report')
job_results = []
@ -46,10 +50,19 @@ class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('extras', '0043_reports'),
('extras', '0042_customfield_manager'),
]
operations = [
migrations.CreateModel(
name='Report',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False)),
],
options={
'managed': False,
},
),
migrations.CreateModel(
name='JobResult',
fields=[

View File

@ -1,22 +0,0 @@
# Generated by Django 3.0.7 on 2020-06-22 20:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('extras', '0042_customfield_manager'),
]
operations = [
migrations.CreateModel(
name='Report',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False)),
],
options={
'managed': False,
},
),
]