summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Reporting/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Bcfg2/Reporting/models.py')
-rw-r--r--src/lib/Bcfg2/Reporting/models.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/lib/Bcfg2/Reporting/models.py b/src/lib/Bcfg2/Reporting/models.py
index ae6f6731b..c28571ded 100644
--- a/src/lib/Bcfg2/Reporting/models.py
+++ b/src/lib/Bcfg2/Reporting/models.py
@@ -1,9 +1,10 @@
"""Django models for Bcfg2 reports."""
import sys
+import django
from django.core.exceptions import ImproperlyConfigured
try:
- from django.db import models, backend, connections
+ from django.db import models, connections
except ImproperlyConfigured:
e = sys.exc_info()[1]
print("Reports: unable to import django models: %s" % e)
@@ -61,11 +62,15 @@ def _quote(value):
"""
global _our_backend
if not _our_backend:
- try:
- _our_backend = backend.DatabaseOperations(
- connections[get_db_label('Reporting')])
- except TypeError:
- _our_backend = backend.DatabaseOperations()
+ if django.VERSION[0] == 1 and django.VERSION[1] >= 7:
+ _our_backend = connections[get_db_label('Reporting')].ops
+ else:
+ from django.db import backend
+ try:
+ _our_backend = backend.DatabaseOperations(
+ connections[get_db_label('Reporting')])
+ except TypeError:
+ _our_backend = backend.DatabaseOperations()
return _our_backend.quote_name(value)
@@ -144,6 +149,8 @@ class Interaction(models.Model):
bad_count = models.IntegerField(default=0)
modified_count = models.IntegerField(default=0)
extra_count = models.IntegerField(default=0)
+ dry_run = models.BooleanField(default=False)
+ only_important = models.BooleanField(default=False)
actions = models.ManyToManyField("ActionEntry")
packages = models.ManyToManyField("PackageEntry")
@@ -174,6 +181,9 @@ class Interaction(models.Model):
groups = models.ManyToManyField("Group")
bundles = models.ManyToManyField("Bundle")
+ # Is the import ready?
+ ready = models.BooleanField(default=False)
+
objects = InteractionManager()
def __str__(self):
@@ -630,7 +640,7 @@ class POSIXGroupEntry(SuccessEntry):
class PackageEntry(SuccessEntry):
""" The new model for package information """
- # if this is an extra entry trget_version will be empty
+ # if this is an extra entry target_version will be empty
target_version = models.CharField(max_length=1024, default='')
current_version = models.CharField(max_length=1024)
verification_details = models.TextField(default="")