Consider an application with:
app label = "App"
model name = "Inventory" with tablename="inventory"
If a particular model's `change_form.html` needs to be overwritten we
would do the following
In Linux:
Overwrite `template/django/admin/App/inventory/change_form.html`
In OSX:
Overwrite `template/django/admin/app/inventory/change_form.html`
The app_label variable should be lowercased so the differing file systems
do not cause this issue.
--
Ticket URL: <https://code.djangoproject.com/ticket/34155>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* version: 4.1 => 3.2
--
Ticket URL: <https://code.djangoproject.com/ticket/34155#comment:1>
Old description:
> In case of differing environments, such as the linux FS and the OSX FS,
> folders case-matching is important.
>
> Consider an application with:
> app label = "App"
> model name = "Inventory" with tablename="inventory"
>
> If a particular model's `change_form.html` needs to be overwritten we
> would do the following
> In Linux:
> Overwrite `template/django/admin/App/inventory/change_form.html`
> In OSX:
> Overwrite `template/django/admin/app/inventory/change_form.html`
>
> The app_label variable should be lowercased so the differing file systems
> do not cause this issue.
New description:
In case of differing environments, such as the linux FS and the OSX FS,
folders case-matching is important.
Consider an application with:
app label = "App"
model name = "Inventory" with tablename="inventory"
If a particular model's `change_form.html` needs to be overwritten we
would do the following
Overwrite `template/django/admin/App/inventory/change_form.html`
This works fine on Linux systems.
However on OSX systems the file shows up as
`template/django/admin/app/inventory/change_form.html`.
This breaks the functionality since the template is no longer found in the
`App/inventory` directory.
The app_label variable should be lowercased so the differing file systems
do not cause this issue.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/34155#comment:2>
* easy: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/34155#comment:3>
* component: Uncategorized => contrib.admin
--
Ticket URL: <https://code.djangoproject.com/ticket/34155#comment:4>
* cc: Carlton Gibson (added)
* status: new => closed
* resolution: => needsinfo
* easy: 1 => 0
Comment:
> The `app_label` variable should be lowercased so the differing file
systems do not cause this issue.
`app` and `App` are two different directories, so forcing lowercase would
be highly backward incompatible. As far as I'm aware, the `APFS`
filesystem is not case insensitive so I'm sure what kind of issue you are
facing 🤔
--
Ticket URL: <https://code.djangoproject.com/ticket/34155#comment:5>
Comment (by Carlton Gibson):
macOS APFS is case insensitive:
{{{
% mkdir App
% mkdir app
mkdir: app: File exists
% ls
App
% diskutil info /System/Volumes/Data | grep Personality
File System Personality: APFS
}}}
However...
> However on OSX systems the file shows up as
template/django/admin/app/inventory/change_form.html.
> This breaks the functionality since the template is no longer found in
the App/inventory directory.
On macOS I'd expect the template to be found regardless of the casing of
the `app` directory.
(A full runnable example showing otherwise please.)
This is a long-standing gotcha of macOS. Linux has case sensitive names so
don't use `App` unless you mean it there. It's best just to use lowercase,
and then you don't hit problems.
(Use `AppConfig.verbose_name` if you want that for display purposes.)
> ...forcing lowercase would be highly backward incompatible
Exactly. This isn't something we can realistically change.
--
Ticket URL: <https://code.djangoproject.com/ticket/34155#comment:6>
Comment (by Mariusz Felisiak):
> macOS APFS is case insensitive:
TIL
--
Ticket URL: <https://code.djangoproject.com/ticket/34155#comment:7>
Comment (by Rishi Diwan):
I agree backward compatibility breaks, but there is a consistency issue
here.
`InculsionAdminNode.render` explicitly does a `app_label.lower()` so we
now have two folders with different cases for the different admin
templates.
The case-sensitive folder has issues in the OSX folders because of the FS.
--
Ticket URL: <https://code.djangoproject.com/ticket/34155#comment:8>