From 71226657449ae821f6a89682eb2a8873aaad8210 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Wed, 12 May 2021 16:22:43 +0300 Subject: Fix manage check warnings --- servo/models/device.py | 2 +- servo/models/note.py | 4 ++-- servo/models/repair.py | 6 ++++-- settings.py | 23 +++++++++++++++++++++++ 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/servo/models/device.py b/servo/models/device.py index 6487179..a506874 100644 --- a/servo/models/device.py +++ b/servo/models/device.py @@ -79,7 +79,7 @@ class Device(models.Model): max_length=128, verbose_name=_("Next Tether Policy") ) - unlocked = models.NullBooleanField(default=None, editable=False) + unlocked = models.BooleanField(default=None, editable=False, null=True) slug = models.SlugField(null=True, editable=False, max_length=128) PRODUCT_LINES = gsxws.products.models() LINE_CHOICES = [(k, x['name']) for k, x in PRODUCT_LINES.items()] diff --git a/servo/models/note.py b/servo/models/note.py index 52aacb7..77865cd 100644 --- a/servo/models/note.py +++ b/servo/models/note.py @@ -652,8 +652,8 @@ class Article(models.Model): product_model = ArrayField(models.CharField(max_length=128), null=True, editable=False) - read_by = ArrayField(models.IntegerField(), default=[]) - flagged_by = ArrayField(models.IntegerField(), default=[]) + read_by = ArrayField(models.IntegerField(), default=list) + flagged_by = ArrayField(models.IntegerField(), default=list) def get_creation_date(self): return self.date_created diff --git a/servo/models/repair.py b/servo/models/repair.py index 3568684..6af3d32 100644 --- a/servo/models/repair.py +++ b/servo/models/repair.py @@ -190,12 +190,14 @@ class Repair(models.Model): ) component_data = models.TextField(default='', editable=False) - consumer_law = models.NullBooleanField( + consumer_law = models.BooleanField( default=None, + null=True, help_text=_('Repair is eligible for consumer law coverage') ) - acplus = models.NullBooleanField( + acplus = models.BooleanField( default=None, + null=True, verbose_name=_('AppleCare+'), help_text=_('Repair is covered by AppleCare+') ) diff --git a/settings.py b/settings.py index c53a3c7..fb8d9a2 100644 --- a/settings.py +++ b/settings.py @@ -51,6 +51,11 @@ STATICFILES_FINDERS = ( # Absolute path to the directory that will hold temporary files. TEMP_ROOT = os.path.join(MEDIA_ROOT, 'temp') +# Default primary key field type +# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage' MIDDLEWARE_CLASSES = ( @@ -73,6 +78,24 @@ SESSION_SERIALIZER = 'servo.lib.utils.SessionSerializer' # Python dotted path to the WSGI application used by Django's runserver. WSGI_APPLICATION = 'wsgi.application' +# Password validation +# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', -- cgit v1.2.3