mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fix up schema migration; PEP8 cleanup
This commit is contained in:
@ -1,24 +1,23 @@
|
|||||||
# Generated by Django 3.0.7 on 2020-06-23 02:28
|
|
||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
import django.contrib.postgres.fields.jsonb
|
import django.contrib.postgres.fields.jsonb
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
import extras.utils
|
import extras.utils
|
||||||
|
from extras.choices import JobResultStatusChoices
|
||||||
|
|
||||||
|
|
||||||
def convert_job_results(apps, schema_editor):
|
def convert_job_results(apps, schema_editor):
|
||||||
"""
|
"""
|
||||||
Convert ReportResult objects to JobResult objects
|
Convert ReportResult objects to JobResult objects
|
||||||
"""
|
"""
|
||||||
from extras.choices import JobResultStatusChoices
|
Report = apps.get_model('extras', 'Report')
|
||||||
|
|
||||||
ReportResult = apps.get_model('extras', 'ReportResult')
|
ReportResult = apps.get_model('extras', 'ReportResult')
|
||||||
JobResult = apps.get_model('extras', 'JobResult')
|
JobResult = apps.get_model('extras', 'JobResult')
|
||||||
ContentType = apps.get_model('contenttypes', 'ContentType')
|
ContentType = apps.get_model('contenttypes', 'ContentType')
|
||||||
report_content_type = ContentType.objects.get(app_label='extras', model='report')
|
report_content_type = ContentType.objects.get_for_model(Report)
|
||||||
|
|
||||||
job_results = []
|
job_results = []
|
||||||
for report_result in ReportResult.objects.all():
|
for report_result in ReportResult.objects.all():
|
||||||
@ -46,7 +45,7 @@ class Migration(migrations.Migration):
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
('contenttypes', '0002_remove_content_type_name'),
|
('contenttypes', '0002_remove_content_type_name'),
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
('extras', '0043_report_model'),
|
('extras', '0043_report'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
@ -662,7 +662,6 @@ class JobResult(models.Model):
|
|||||||
|
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def enqueue_job(cls, func, name, obj_type, user, *args, **kwargs):
|
def enqueue_job(cls, func, name, obj_type, user, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
@ -431,6 +431,7 @@ class ReportResultView(ContentTypePermissionRequiredMixin, GetReportMixin, View)
|
|||||||
'run_form': ConfirmationForm(),
|
'run_form': ConfirmationForm(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Scripts
|
# Scripts
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user