Open BMourguesFieldbox opened 7 months ago
@BMourguesFieldbox thank you for this suggestion, it's indeed interesting, I will think more about it.
great solution, instead of CharField
, i'll be use a FilePathField
from django docs FilePathField
great solution, instead of
CharField
, i'll be use aFilePathField
from django docs FilePathField
Good catch ! Didn't think of it, but sure thanks for the suggestion!
great solution, instead of
CharField
, i'll be use aFilePathField
from django docs FilePathFieldGood catch ! Didn't think of it, but sure thanks for the suggestion!
It's better, because you have more control instead of classic CharField
@FraCata00 @BMourguesFieldbox to allow users to decide which directory to choose the file from, a conf setting must be added for setting the field path, but this would impact migrations.
@fabiocaccamo the users would do a migration command, cause new field features..
@FraCata00 indeed, but that migration will be added to admin_interface
app, and when in the future this app will have new migrations there will be some conflicts.
@fabiocaccamo why should there be conflicts?
@FraCata00 I try to explain you step by step:
makemigrations
, and as result you will have 32 migrations inside admin_interface
package, but the "real" application that you install from pip has only 31 migrations@fabiocaccamo but if you customize the path setting, should not run makemigrations
, is a features of FilePathField
. We can add a callable to dynamically return the path for the new field, any opinions?
@FraCata00 should test it very well:
@fabiocaccamo yessir, after work i'll try it okay?
Like the ImageField
with a callable upload_to
, cannot create every time a new migrations
The FilePathField
instead a ImageField
, accept an existent file in file system, like a poiinter of file system path
@fabiocaccamo I confirm that no new migrations are crreated if the value in settings changed 👍🏻
@FraCata00 good news! (should write a couple of test case anyway)
@fabiocaccamo @BMourguesFieldbox I tested personally yesterday evening in my branch to introduce this functionality Just a little bit of testing it better, and i'll do a PR 👍🏻
N.B.:
The FilePathField
allow (in my case with a custom settings conf), to add a path with some file (just use the match
key field to match the most use-case image file (like svg, png, jpg, jpeg) and the django admin provide a html widget select to select the static logo (catched by path)
just add a custom def clean()
in Theme
model and 2 new fields:
@FraCata00 I would add only a new logo_static
field, then if both are defined in the backend, the media will have the priority.
@fabiocaccamo oh, maybe is a better solution
@fabiocaccamo sorry for the time *I'm in the office tomorrow morning 😆 ), check PR to solve this issue #378
In the current version, the logo can be user uploaded. However, this means that the app has to handle user uploaded documents and serve them.
When building the admin for business client, the logo will most likely be in static files, and I think it could save some complexity to have the possibility to use a CharField that would point to a static file
app/logo.png
for example.Then the template would be with a condition
Wdyt ?
Upvote & Fund