This repository has been archived by the owner on Oct 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved file_path to module base.fields.functions
- Loading branch information
agustin
committed
Dec 7, 2021
1 parent
ee11a95
commit 3f920b7
Showing
3 changed files
with
33 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from .base import BaseFileField | ||
from .base import ChileanRUTField | ||
|
||
|
||
__all__ = [ | ||
'BaseFileField', | ||
'ChileanRUTField', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from base import utils | ||
|
||
|
||
# public methods | ||
def file_path(self, name): | ||
""" | ||
Generic method to give to a FileField or ImageField in it's upload_to | ||
parameter. | ||
This returns the name of the class, concatenated with the id of the | ||
object and the name of the file. | ||
""" | ||
base_path = "{}/{}/{}/{}" | ||
|
||
return base_path.format( | ||
self.__class__.__name__, | ||
str(utils.today()), | ||
utils.random_string(30), | ||
name | ||
) |