From 5f6909d32a6a973dd66d20b1f97b55e852827c7c Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 4 May 2019 01:00:58 +1000 Subject: [PATCH 1/3] Add django-dbbackup app - https://github.com/un1t/django-cleanup - Backup location defaults to temp directory --- InvenTree/InvenTree/settings.py | 18 ++++++++++++------ requirements.txt | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index e35400a831..ce2814c5a4 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/1.10/ref/settings/ import os import logging +import tempfile # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -56,12 +57,13 @@ INSTALLED_APPS = [ 'build.apps.BuildConfig', # Third part add-ons - 'django_filters', - 'rest_framework', - 'crispy_forms', - 'import_export', - 'django_cleanup', - 'qr_code', + 'django_filters', # Extended filter functionality + 'dbbackup', # Database backup / restore + 'rest_framework', # DRF (Django Rest Framework) + 'crispy_forms', # Improved form rendering + 'import_export', # Import / export tables to file + 'django_cleanup', # Automatically delete orphaned MEDIA files + 'qr_code', # Generate QR codes ] MIDDLEWARE = [ @@ -174,3 +176,7 @@ CRISPY_TEMPLATE_PACK = 'bootstrap' # Use database transactions when importing / exporting data IMPORT_EXPORT_USE_TRANSACTIONS = True + +# Settings for dbbsettings app +DBBACKUP_STORAGE = 'django.core.files.storage.FileSystemStorage' +DBBACKUP_STORAGE_OPTIONS = {'location': tempfile.gettempdir()} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 2bc353b3ee..dee0690a62 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ psycopg2>=2.8.1 # PostgreSQL package pillow>=5.0.0 # Image manipulation djangorestframework>=3.6.2 # DRF framework django_filter>=1.0.2 # Extended filtering options +django-dbbackup==3.2.0 # Database backup / restore functionality coreapi>=2.3.0 # API documentation pygments>=2.2.0 # Syntax highlighting tablib>=0.13.0 # Import / export data files From 6c7613ba2f3968d21b2a6fa9ecbf3d5d410b6f52 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 4 May 2019 01:03:43 +1000 Subject: [PATCH 2/3] Fix form title --- InvenTree/part/views.py | 1 + 1 file changed, 1 insertion(+) diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index bdc3147e9b..27d52dcdb7 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -119,6 +119,7 @@ class PartAttachmentDelete(AjaxDeleteView): """ View for deleting a PartAttachment """ model = PartAttachment + ajax_form_title = "Delete Part Attachment" ajax_template_name = "part/attachment_delete.html" context_object_name = "attachment" From 517262b2331bde2e2aac0663a97cd16774512fba Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 4 May 2019 01:04:30 +1000 Subject: [PATCH 3/3] PEP fixes --- InvenTree/InvenTree/settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index ce2814c5a4..82c8a99507 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -12,7 +12,7 @@ https://docs.djangoproject.com/en/1.10/ref/settings/ import os import logging -import tempfile +import tempfile # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -179,4 +179,4 @@ IMPORT_EXPORT_USE_TRANSACTIONS = True # Settings for dbbsettings app DBBACKUP_STORAGE = 'django.core.files.storage.FileSystemStorage' -DBBACKUP_STORAGE_OPTIONS = {'location': tempfile.gettempdir()} \ No newline at end of file +DBBACKUP_STORAGE_OPTIONS = {'location': tempfile.gettempdir()}