mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-09 22:38:19 +02:00
fix utils.get_save_path
fix get_save_path in Migration
This commit is contained in:
parent
2824cde5e9
commit
02acef8ede
2 changed files with 12 additions and 11 deletions
|
|
@ -12,6 +12,6 @@ class Migration(migrations.Migration):
|
|||
migrations.AlterField(
|
||||
model_name='messageattachment',
|
||||
name='document',
|
||||
field=models.FileField(upload_to=django_mailbox.utils.get_attachment_save_path, verbose_name='Document'),
|
||||
field=models.FileField(upload_to=django_mailbox.utils.get_save_path(setting='attachment_upload_to'), verbose_name='Document'),
|
||||
),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import os
|
|||
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
|
@ -144,14 +143,16 @@ def get_body_from_message(message, maintype, subtype):
|
|||
return body
|
||||
|
||||
|
||||
def get_save_path(instance, filename, setting):
|
||||
settings = get_settings()
|
||||
def get_save_path(setting):
|
||||
def _tmp(instance, filename):
|
||||
settings = get_settings()
|
||||
|
||||
path = settings[setting]
|
||||
if '%' in path:
|
||||
path = datetime.datetime.utcnow().strftime(path)
|
||||
path = settings[setting]
|
||||
if '%' in path:
|
||||
path = datetime.datetime.utcnow().strftime(path)
|
||||
|
||||
return os.path.join(
|
||||
path,
|
||||
filename,
|
||||
)
|
||||
return os.path.join(
|
||||
path,
|
||||
filename,
|
||||
)
|
||||
return _tmp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue