diff options
author | Filipp Lepalaan <filipp@mac.com> | 2021-05-12 15:58:07 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2021-05-12 15:58:07 +0300 |
commit | 517e3c2bf8d34d8d71d3974634963a0e6e76c305 (patch) | |
tree | a14eb2d6121e9270fba3e8465fd6fcf1afc8048d /servo | |
parent | 8c4fbdd167aa22eff70abd85da20a2187f207812 (diff) | |
download | Servo-517e3c2bf8d34d8d71d3974634963a0e6e76c305.tar.gz Servo-517e3c2bf8d34d8d71d3974634963a0e6e76c305.tar.bz2 Servo-517e3c2bf8d34d8d71d3974634963a0e6e76c305.zip |
Fix manage check errors
Diffstat (limited to 'servo')
-rw-r--r-- | servo/models/common.py | 10 | ||||
-rw-r--r-- | servo/models/escalations.py | 1 | ||||
-rw-r--r-- | servo/models/invoices.py | 9 | ||||
-rw-r--r-- | servo/models/note.py | 9 | ||||
-rw-r--r-- | servo/models/purchases.py | 2 | ||||
-rw-r--r-- | servo/models/rules.py | 2 | ||||
-rw-r--r-- | servo/models/shipments.py | 1 |
7 files changed, 24 insertions, 10 deletions
diff --git a/servo/models/common.py b/servo/models/common.py index 81e6855..f92485e 100644 --- a/servo/models/common.py +++ b/servo/models/common.py @@ -99,6 +99,7 @@ class FlaggedItem(models.Model): ref_id = models.IntegerField() flagged_by = models.ForeignKey( settings.AUTH_USER_MODEL, + null=True, on_delete=models.SET_NULL ) @@ -113,6 +114,7 @@ class Event(models.Model): description = models.CharField(max_length=255) triggered_by = models.ForeignKey( settings.AUTH_USER_MODEL, + null=True, on_delete=models.SET_NULL) triggered_at = models.DateTimeField(auto_now_add=True) handled_at = models.DateTimeField(null=True) @@ -173,7 +175,7 @@ class GsxAccount(models.Model): ) timezone = models.CharField( - max_length=4, + max_length=8, default='CEST', verbose_name=_('Timezone'), choices=gsxws.GSX_TIMEZONES @@ -288,7 +290,7 @@ class GsxAccount(models.Model): ordering = ['title'] verbose_name = _("GSX Account") verbose_name_plural = _("GSX Accounts") - unique_together = ('sold_to', 'ship_to', 'environment', 'site',) + unique_together = ('sold_to', 'ship_to', 'environment',) class Tag(MPTTModel): @@ -438,7 +440,7 @@ class Location(models.Model): ) gsx_tz = models.CharField( - max_length=4, + max_length=8, default='CEST', verbose_name=_('Timezone'), choices=gsxws.GSX_TIMEZONES @@ -517,7 +519,6 @@ class Location(models.Model): get_latest_by = 'id' verbose_name = _('Location') verbose_name_plural = _('Locations') - unique_together = ('title', 'site',) class Configuration(models.Model): @@ -641,7 +642,6 @@ class Configuration(models.Model): class Meta: app_label = 'servo' - unique_together = ('key', 'site',) class Property(models.Model): diff --git a/servo/models/escalations.py b/servo/models/escalations.py index b42d8ca..ffe1486 100644 --- a/servo/models/escalations.py +++ b/servo/models/escalations.py @@ -23,6 +23,7 @@ class Escalation(models.Model): ) gsx_account = models.ForeignKey( GsxAccount, + null=True, on_delete=models.SET_NULL, default=defaults.gsx_account, verbose_name=_('GSX Account'), diff --git a/servo/models/invoices.py b/servo/models/invoices.py index cbcbd66..3aa1d25 100644 --- a/servo/models/invoices.py +++ b/servo/models/invoices.py @@ -14,7 +14,10 @@ from servo.models import (User, Customer, Order, Location, class Invoice(models.Model): created_at = models.DateTimeField(editable=False, auto_now_add=True) - created_by = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.SET_NULL) + created_by = models.ForeignKey(settings.AUTH_USER_MODEL, + null=True, + editable=False, + on_delete=models.SET_NULL) PAYMENT_METHODS = ( (0, _("No Charge")), @@ -184,7 +187,9 @@ class Payment(models.Model): default=METHODS[0][0], verbose_name=_("Payment Method") ) - created_by = models.ForeignKey(User, on_delete=models.SET_NULL) + created_by = models.ForeignKey(User, + null=True, + on_delete=models.SET_NULL) created_at = models.DateTimeField(auto_now_add=True) amount = models.DecimalField(max_digits=8, decimal_places=2) diff --git a/servo/models/note.py b/servo/models/note.py index 1e0e565..52aacb7 100644 --- a/servo/models/note.py +++ b/servo/models/note.py @@ -107,7 +107,10 @@ class Note(MPTTModel): ) created_at = models.DateTimeField(auto_now_add=True, editable=False) - created_by = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.SET_NULL) + created_by = models.ForeignKey(settings.AUTH_USER_MODEL, + null=True, + editable=False, + on_delete=models.SET_NULL) sent_at = models.DateTimeField(null=True, editable=False) order = models.ForeignKey(Order, null=True, blank=True, on_delete=models.CASCADE) @@ -575,7 +578,9 @@ class Message(models.Model): """ note = models.ForeignKey(Note, on_delete=models.CASCADE) code = models.CharField(unique=True, max_length=36, default=defaults.uid) - created_by = models.ForeignKey(User, on_delete=models.SET_NULL) + created_by = models.ForeignKey(User, + null=True, + on_delete=models.SET_NULL) sender = models.CharField(max_length=128) recipient = models.CharField(max_length=128) body = models.TextField() diff --git a/servo/models/purchases.py b/servo/models/purchases.py index f79bc6e..8d4fcac 100644 --- a/servo/models/purchases.py +++ b/servo/models/purchases.py @@ -27,6 +27,7 @@ class PurchaseOrder(models.Model): location = models.ForeignKey( Location, editable=False, + null=True, on_delete=models.SET_NULL, help_text=_('The location from which this PO was created') ) @@ -46,6 +47,7 @@ class PurchaseOrder(models.Model): created_by = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, + null=True, on_delete=models.SET_NULL) created_at = models.DateTimeField(auto_now_add=True, editable=False) submitted_at = models.DateTimeField(null=True, editable=False) diff --git a/servo/models/rules.py b/servo/models/rules.py index 14fc3bb..f2ffa6a 100644 --- a/servo/models/rules.py +++ b/servo/models/rules.py @@ -101,7 +101,7 @@ class Condition(ServoModel): ('%d > %d', _('Greater than')), ) operator = models.CharField( - max_length=4, + max_length=8, default='^%s$', choices=OPERATOR_CHOICES ) diff --git a/servo/models/shipments.py b/servo/models/shipments.py index 9f93927..9dba9b3 100644 --- a/servo/models/shipments.py +++ b/servo/models/shipments.py @@ -22,6 +22,7 @@ class Shipment(models.Model): location = models.ForeignKey(Location, editable=False, + null=True, on_delete=models.SET_NULL) ship_to = models.CharField( |