From 56ca2c47a45fafee8a84cad5334333279e77d9e7 Mon Sep 17 00:00:00 2001 From: Maxime Bombar Date: Tue, 25 Sep 2018 13:39:12 +0200 Subject: [PATCH] Move printing_path from models to utils --- printer/models.py | 3 ++- printer/utils.py | 10 ---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/printer/models.py b/printer/models.py index e64343b2..4bcb98e4 100644 --- a/printer/models.py +++ b/printer/models.py @@ -18,6 +18,8 @@ from re2o.mixins import RevMixin import users.models +import unidecode + from .validators import ( FileValidator, ) @@ -33,7 +35,6 @@ from .settings import ( PERFORATION_OPTIONS, ) -from .utils import user_printing_path import math diff --git a/printer/utils.py b/printer/utils.py index cfd6a26d..1c67897a 100644 --- a/printer/utils.py +++ b/printer/utils.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- import subprocess import os -import unidecode from django.template.loader import get_template from django.core.mail import EmailMessage @@ -12,15 +11,6 @@ from numpy.random import randint import datetime -def user_printing_path(instance, filename): - """ - Defines the path where will be uploaded the files - Currently MEDIA_ROOT/printings/user_/ - """ - # File will be uploaded to MEDIA_ROOT/printings/user_/ - return 'printings/user_{0}/{1}'.format(instance.user.id, unidecode.unidecode(filename)) - - def pdfinfo(file_path): """