Aggiorno dall'upstream

This commit is contained in:
Davide Borgonovo
2024-07-23 17:25:27 +02:00
parent 900978936e
commit 79de619503
28 changed files with 165 additions and 68 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
from django.core.exceptions import ValidationError
from admin_confirm.admin import AdminConfirmMixin
from admin_confirm import AdminConfirmMixin
from django.contrib.admin import ModelAdmin
from django.forms import ModelForm
+5 -1
View File
@@ -1,6 +1,10 @@
from django.contrib.admin import ModelAdmin
from admin_confirm.admin import AdminConfirmMixin
class GeneralManagerAdmin(ModelAdmin):
class GeneralManagerAdmin(AdminConfirmMixin, ModelAdmin):
save_as = True
search_fields = ["name"]
confirm_change = True
confirm_add = True
confirmation_fields = ["name", "headshot"]
+1 -1
View File
@@ -1,5 +1,5 @@
from django.contrib.admin import ModelAdmin
from admin_confirm.admin import AdminConfirmMixin, confirm_action
from admin_confirm import AdminConfirmMixin, confirm_action
class ShopAdmin(AdminConfirmMixin, ModelAdmin):
-5
View File
@@ -1,5 +0,0 @@
from django.apps import AppConfig
class MarketConfig(AppConfig):
name = "market"
@@ -0,0 +1,28 @@
# Generated by Django 3.2.5 on 2021-07-02 00:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('market', '0012_auto_20210326_0240'),
]
operations = [
migrations.AlterField(
model_name='itemsale',
name='total',
field=models.DecimalField(decimal_places=2, max_digits=5),
),
migrations.AlterField(
model_name='shoppingmall',
name='shops',
field=models.ManyToManyField(blank=True, to='market.Shop'),
),
migrations.AlterField(
model_name='transaction',
name='total',
field=models.DecimalField(decimal_places=2, default=0, max_digits=5),
),
]
@@ -0,0 +1,19 @@
# Generated by Django 3.1.7 on 2022-04-13 01:16
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('market', '0013_auto_20210702_0041'),
]
operations = [
migrations.AlterField(
model_name='shoppingmall',
name='general_manager',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='market.generalmanager', verbose_name='manager'),
),
]
+1 -1
View File
@@ -54,7 +54,7 @@ class ShoppingMall(models.Model):
name = models.CharField(max_length=120)
shops = models.ManyToManyField(Shop, blank=True)
general_manager = models.OneToOneField(
GeneralManager, on_delete=models.CASCADE, null=True, blank=True
GeneralManager, on_delete=models.CASCADE, null=True, blank=True, verbose_name="manager"
)
town = models.ForeignKey(Town, on_delete=models.CASCADE, null=True, blank=True)
+1 -1
View File
@@ -2,5 +2,5 @@
# And running the server are different
# (Possibly due to test_project being within a subfolder)
# This defaults settings to local unless
# DJANGO_SETTINGS is specified.
# DJANGO_SETTINGS_MODULE is specified.
from .local import *
+9 -5
View File
@@ -138,15 +138,17 @@ if USE_S3:
AWS_SECRET_ACCESS_KEY = os.getenv("AWS_SECRET_ACCESS_KEY", "test")
AWS_STORAGE_BUCKET_NAME = os.getenv("AWS_STORAGE_BUCKET_NAME", "mybucket")
AWS_DEFAULT_ACL = None
AWS_S3_CUSTOM_DOMAIN = f"{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com"
# AWS_S3_CUSTOM_DOMAIN = f"{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com"
AWS_S3_OBJECT_PARAMETERS = {"CacheControl": "max-age=86400"}
# s3 static settings
STATIC_LOCATION = "static"
STATIC_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/{STATIC_LOCATION}/"
STATIC_LOCATION = "staticfiles"
STATIC_URL = f"{AWS_S3_ENDPOINT_URL}/{STATIC_LOCATION}/"
STATIC_ROOT = os.path.join(BASE_DIR, STATIC_LOCATION)
STATICFILES_STORAGE = "tests.storage_backends.StaticStorage"
# s3 public media settings
PUBLIC_MEDIA_LOCATION = "media"
MEDIA_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/{PUBLIC_MEDIA_LOCATION}/"
PUBLIC_MEDIA_LOCATION = "mediafiles"
MEDIA_URL = f"{AWS_S3_ENDPOINT_URL}/{PUBLIC_MEDIA_LOCATION}/"
MEDIA_ROOT = os.path.join(BASE_DIR, PUBLIC_MEDIA_LOCATION)
DEFAULT_FILE_STORAGE = "tests.storage_backends.PublicMediaStorage"
else:
STATIC_URL = "/staticfiles/"
@@ -155,3 +157,5 @@ else:
MEDIA_ROOT = os.path.join(BASE_DIR, "mediafiles")
STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
+3 -1
View File
@@ -4,4 +4,6 @@ INSTALLED_APPS = INSTALLED_APPS + ["market"]
WSGI_APPLICATION = "test_project.wsgi.application"
ROOT_URLCONF = "test_project.urls"
USE_S3 = "True"
if USE_S3:
STATICFILES_STORAGE = "storage_backends.StaticStorage"
DEFAULT_FILE_STORAGE = "storage_backends.PublicMediaStorage"
-2
View File
@@ -3,5 +3,3 @@ from .base import *
INSTALLED_APPS = INSTALLED_APPS + ["tests.market"]
WSGI_APPLICATION = "tests.test_project.wsgi.application"
ROOT_URLCONF = "tests.test_project.urls"
USE_S3 = "True"