mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-25 04:43:10 +00:00
Move printing_path from models to utils
This commit is contained in:
parent
6181c2749b
commit
ee9827deda
2 changed files with 16 additions and 9 deletions
|
@ -26,6 +26,8 @@ from .settings import (
|
||||||
PRICES,
|
PRICES,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from .utils import user_printing_path
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -34,10 +36,6 @@ import math
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def user_printing_path(instance, filename):
|
|
||||||
# File will be uploaded to MEDIA_ROOT/printings/user_<id>/<filename>
|
|
||||||
return 'printings/user_{0}/{1}'.format(instance.user.id, filename)
|
|
||||||
|
|
||||||
|
|
||||||
class JobWithOptions(RevMixin, models.Model):
|
class JobWithOptions(RevMixin, models.Model):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,6 +1,16 @@
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
def user_printing_path(instance, filename):
|
||||||
|
"""
|
||||||
|
Defines the path where will be uploaded the files
|
||||||
|
Currently MEDIA_ROOT/printings/user_<id>/<filename>
|
||||||
|
"""
|
||||||
|
# File will be uploaded to MEDIA_ROOT/printings/user_<id>/<filename>
|
||||||
|
return 'printings/user_{0}/{1}'.format(instance.user.id, filename)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def pdfinfo(file_path):
|
def pdfinfo(file_path):
|
||||||
"""
|
"""
|
||||||
Uses pdfinfo to extract the PDF meta information.
|
Uses pdfinfo to extract the PDF meta information.
|
||||||
|
@ -25,4 +35,3 @@ def pdfinfo(file_path):
|
||||||
output[label] = _extract(line)
|
output[label] = _extract(line)
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue