Skip to content

Commit ef6b8ec

Browse files
committed
Merge branch 'finder' of github.com:django-cms/django-filer into finder
2 parents 281444a + 0abe9af commit ef6b8ec

File tree

116 files changed

+3951
-2350
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+3951
-2350
lines changed

.github/workflows/docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ jobs:
88
name: docs
99
steps:
1010
- name: Checkout
11-
uses: actions/checkout@v2
11+
uses: actions/checkout@v5
1212
- name: Set up Python
13-
uses: actions/setup-python@v2
13+
uses: actions/setup-python@v5
1414
with:
15-
python-version: 3.9
15+
python-version: 3.12
1616
- run: python -m pip install -r docs/requirements.txt
1717
- name: Build docs
1818
run: |

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
with:
1515
python-version: 3.9
1616
- name: Install flake8
17-
run: pip install --upgrade flake8
17+
run: pip install --upgrade flake8 flake8-pyproject
1818
- name: Run flake8
1919
uses: liskin/gh-problem-matcher-wrap@v1
2020
with:

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24

.pre-commit-config.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ repos:
2424
rev: 7.0.0
2525
hooks:
2626
- id: flake8
27-
27+
entry: pflake8
28+
additional_dependencies: [pyproject-flake8]
2829
- repo: https://github.com/asottile/yesqa
2930
rev: v1.5.0
3031
hooks:
3132
- id: yesqa
3233

3334
- repo: https://github.com/pre-commit/pre-commit-hooks
34-
rev: v4.6.0
35+
rev: v6.0.0
3536
hooks:
3637
- id: check-merge-conflict
3738
- id: mixed-line-ending

CHANGELOG.rst

Lines changed: 88 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,99 @@
22
CHANGELOG
33
=========
44

5-
3.2 (2025-05-21)
6-
================
7-
* Fix: Reverse match for 'filer_image_expand_view' not found.
8-
* Drop support for Python 3.8 and 3.9.
9-
* Add support for Python 3.12.
5+
3.3.3 / 2025-11-07
6+
==================
7+
8+
* Pin svglib to a version below 1.6.0 by @payamnj (#1550) in https://github.com/django-cms/django-filer/pull/1551
9+
10+
3.3.2 (2025-09-01)
11+
==================
12+
13+
* fix: add filename length safety check with random suffix by @Baraff24 in https://github.com/django-cms/django-filer/pull/1515
14+
* fix: Remove user from autocomplete fields if (swapped) user model does not have search fields by @fsbraun in https://github.com/django-cms/django-filer/pull/1517
15+
* Fix: Include Private Storage in Orphan File Scanning for filer_check Command by @Baraff24 in https://github.com/django-cms/django-filer/pull/1518
16+
* fix: Relect template block structure of Django 5.2+ by @fsbraun in https://github.com/django-cms/django-filer/pull/1523
17+
* chore: Added Full Persian (Farsi) Translate by @dimacodev in https://github.com/django-cms/django-filer/pull/1524
18+
* fix: Update directory_table_list.html by @AliAkbarSobhanpoor in https://github.com/django-cms/django-filer/pull/1528
19+
* fix: Avoid locale-dependent ratio by @albanbochsler in https://github.com/django-cms/django-filer/pull/1536
20+
* fix: docs GitHub action built by @fsbraun in https://github.com/django-cms/django-filer/pull/1540
21+
* fix: Folder permission cache update sometimes raised TypeError by @fsbraun in https://github.com/django-cms/django-filer/pull/1539
22+
* fix: Failed to install submodules of filer by @fsbraun in https://github.com/django-cms/django-filer/pull/1544
23+
24+
**New Contributors**
25+
26+
* @Baraff24 made their first contribution in https://github.com/django-cms/django-filer/pull/1515
27+
* @dimacodev made their first contribution in https://github.com/django-cms/django-filer/pull/1524
28+
* @AliAkbarSobhanpoor made their first contribution in https://github.com/django-cms/django-filer/pull/1528
29+
* @albanbochsler made their first contribution in https://github.com/django-cms/django-filer/pull/1536
30+
31+
3.3.1 (2024-12-07)
32+
==================
33+
34+
* fix: editing buttons missing in admin when file present by @pajowu in https://github.com/django-cms/django-filer/pull/1511
35+
* fix: incompatibility with djangocms-versioning-filer 1.3 was fixed by @fscherf in https://github.com/django-cms/django-filer/pull/1509
36+
37+
**New Contributors**
38+
39+
* @pajowu made their first contribution in https://github.com/django-cms/django-filer/pull/1511
40+
* @fscherf made their first contribution in https://github.com/django-cms/django-filer/pull/1509
41+
42+
3.3.0 (2024-11-19)
43+
==================
44+
45+
* fix: Restrict upload of binary or unknown file types by default by @fsbraun in https://github.com/django-cms/django-filer/pull/1507
46+
* fix: remove extra brace in generated HTML of data-max-filesize attribute by @fabien-michel in https://github.com/django-cms/django-filer/pull/1502
47+
* fix: uploadButton data-max-filesize attribute is not passed to file-uploader by @fabien-michel in https://github.com/django-cms/django-filer/pull/1503
48+
* docs: Update for on_delete requirement in Filer fields
49+
50+
3.2.3 (2024-09-18)
51+
==================
52+
53+
* fix: Use TypeVar for type-hinting of the user parameter by @payamnj in https://github.com/django-cms/django-filer/pull/1496
54+
55+
** New contributor**
56+
57+
* @payamnj made their first contribution in https://github.com/django-cms/django-filer/pull/1496
58+
59+
60+
3.2.2 (2024-09-09)
61+
==================
62+
63+
* fix: Remove version pin to Django<5.1
64+
65+
3.2.1 (2024-09-05)
66+
==================
67+
68+
* fix: Restore python 3.8 and python 3.9 compatibility
69+
70+
3.2.0 (2024-08-23)
71+
==================
72+
73+
* feat: Add cache for permission checks by @fsbraun in https://github.com/django-cms/django-filer/pull/1486
74+
* fix: Reduce number of thumbnails created for admin, avoid admin thumbnails for svg files by @fsbraun in https://github.com/django-cms/django-filer/pull/1490
75+
* fix: Allow ``Image.MAX_IMAGE_PIXELS`` to be ``None`` by @fsbraun in https://github.com/django-cms/django-filer/pull/1475
76+
* docs: Update extending_filer.rst by @DmytroLitvinov in https://github.com/django-cms/django-filer/pull/1488
77+
78+
**New contributor:**
79+
80+
* @DmytroLitvinov made their first contribution in https://github.com/django-cms/django-filer/pull/1488
81+
82+
3.1.4 (2024-07-15)
83+
==================
84+
85+
* feat: Accept new `STORAGES` setting, introduced in Django 4.2 by @fsbraun in https://github.com/django-cms/django-filer/pull/1472
86+
* feat: Replace `render` with `TemplateResponse` in admin views by @fsbraun in https://github.com/django-cms/django-filer/pull/1473
87+
* fix: File expand url incorrect and worked not with custom image models by @fsbraun in https://github.com/django-cms/django-filer/pull/1471
88+
* fix: Crash when moving files from a filtered directory listing by @W1ldPo1nter in https://github.com/django-cms/django-filer/pull/1482
89+
* ci: pre-commit autoupdate by @pre-commit-ci in https://github.com/django-cms/django-filer/pull/1477
1090

1191

12-
3.1.3 (2025-05-17)
92+
3.1.3 (2024-05-17)
1393
==================
1494
* Fix: Folder select widget did not render correctly with standard Django admin
1595
styles.
1696

17-
3.1.2 (2025-05-17)
97+
3.1.2 (2024-05-17)
1898
==================
1999

20100
* Made the filer check command compatible with custom image models.
@@ -719,7 +799,7 @@ CHANGELOG
719799

720800

721801
0.5.4a1
722-
=======
802+
========
723803

724804
* Adds description field.
725805

MANIFEST.in

Lines changed: 0 additions & 7 deletions
This file was deleted.

README-Finder.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,7 @@ git switch finder
117117
pip install --no-deps -e .
118118
```
119119

120-
The new version of **django-filer** requires Django-5.2 or later. Since this hasn't been
121-
released, you have to install the current development version of Django from GitHub rather than PyPI
122-
using:
123-
124-
```shell
125-
pip install https://github.com/django/django/archive/refs/heads/main.zip
126-
```
120+
The new version of **django-filer** requires Django-5.2 or later.
127121

128122
The new version of **django-filer** currently has only been tested with SQLite and Postgres, but
129123
should also work on MariaDB and MySQL.

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ for all the details on how to install, configure and use django-filer.
5454
:target: http://badge.fury.io/py/django-filer
5555
.. |coverage| image:: https://codecov.io/gh/django-cms/django-filer/branch/master/graph/badge.svg
5656
:target: https://codecov.io/gh/django-cms/django-filer
57-
.. |python| image:: https://img.shields.io/badge/python-3.8+-blue.svg
57+
.. |python| image:: https://img.shields.io/badge/python-3.10+-blue.svg
5858
:target: https://pypi.org/project/django-filer/
5959
.. |django| image:: https://img.shields.io/badge/django-3.2+-blue.svg
6060
:target: https://www.djangoproject.com/

client/admin/FolderAdmin.tsx

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -200,19 +200,35 @@ export default function FolderAdmin() {
200200
const sourceFolderId = active.data.current.folderId;
201201
let inodes = columnRefs[sourceFolderId].current?.inodes ?? [];
202202
if (over) {
203-
let [what, targetFolderId] = over.id.split(':');
204-
targetFolderId = targetFolderId === 'parent' ? settings.parent_id : targetFolderId;
205-
if (!draggedInodes.some(inode => [inode.id, inode.parent].includes(targetFolderId))) {
203+
let [what, targetInodeId, targetFolderId] = over.id.split(':');
204+
if (targetFolderId === undefined) {
205+
targetFolderId = targetInodeId === 'parent' ? settings.parent_id : targetInodeId;
206+
}
207+
if (!draggedInodes.some(inode => [inode.id, inode.parent].includes(targetInodeId))) {
206208
overlayRef.current.hidden = true;
207-
if (what === 'download') {
208-
downloadFiles(draggedInodes);
209-
setTimeout(() => {
210-
overlayRef.current.hidden = false;
211-
setDraggedInodes([]);
212-
}, 1000);
213-
return;
209+
let action: string;
210+
switch (what) {
211+
case 'download':
212+
downloadFiles(draggedInodes);
213+
setTimeout(() => {
214+
overlayRef.current.hidden = false;
215+
setDraggedInodes([]);
216+
}, 1000);
217+
return;
218+
case 'folder': case 'column': case 'tab':
219+
action = 'move';
220+
break;
221+
case 'discard':
222+
action = 'delete';
223+
break;
224+
case 'reorder':
225+
action = 'reorder';
226+
break;
227+
default:
228+
console.error(`Unknown drop target: ${what}`);
229+
return;
214230
}
215-
let fetchUrl = `${settings.base_url}${settings.folder_id}/${what === 'discard' ? 'delete' : 'move'}`;
231+
let fetchUrl = `${settings.base_url}${settings.folder_id}/${action}`;
216232
const response = await fetch(fetchUrl, {
217233
method: 'POST',
218234
headers: {
@@ -221,20 +237,24 @@ export default function FolderAdmin() {
221237
},
222238
body: JSON.stringify({
223239
inode_ids: draggedInodes.map(inode => inode.id),
224-
target_folder: targetFolderId,
240+
target_id: targetInodeId,
225241
}),
226242
});
227243
if (response.ok) {
228244
const body = await response.json();
229245
if (body.inodes && columnRefs[targetFolderId]?.current) {
230-
const inodes = body.inodes.map(inode => ({...inode, elementRef: createRef()}));
231-
columnRefs[targetFolderId].current.setInodes(inodes);
246+
const targetInodes = body.inodes.map(inode => ({...inode, elementRef: createRef()}));
247+
columnRefs[targetFolderId].current.setInodes(targetInodes);
248+
if (sourceFolderId === targetFolderId) {
249+
inodes = targetInodes;
250+
}
232251
}
233252
if (body.favorite_folders) {
234253
folderTabsRef.current.setFavoriteFolders(body.favorite_folders);
235254
}
236-
inodes = inodes.filter(inode => !inode.dragged);
237-
columnRefs[sourceFolderId].current.setInodes(inodes);
255+
if (sourceFolderId !== targetFolderId) {
256+
inodes = inodes.filter(inode => !inode.dragged);
257+
}
238258
} else if (response.status === 409) {
239259
alert(await response.text());
240260
} else {

client/admin/Item.tsx

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
import React, {lazy, Suspense, useContext, useEffect, useMemo, useState} from 'react';
22
import {useDraggable, useDroppable} from '@dnd-kit/core';
33
import FinderSettings from './FinderSettings';
4+
import DroppableArea from './DroppableArea';
5+
import {useSearchParam} from './SearchField';
6+
import {useSorting} from '../common/SortingOptions';
7+
import {useFilter} from '../common/FilterByLabel';
48
import FigureLabels from '../common/FigureLabels';
9+
import {Tooltip, TooltipContent, TooltipTrigger} from "../common/Tooltip";
510

611

712
const dateTimeFormatter = new Intl.DateTimeFormat(
813
navigator.language,
914
{timeStyle: 'short', dateStyle: 'short'} as Intl.DateTimeFormatOptions,
1015
);
1116

17+
1218
export function DraggableItem(props) {
1319
const {
1420
attributes,
@@ -20,6 +26,24 @@ export function DraggableItem(props) {
2026
disabled: props.disabled,
2127
});
2228
const [event, setEvent] = useState<PointerEvent>(null);
29+
const [sorting] = useSorting();
30+
const [filter] = useFilter();
31+
const [searchQuery] = useSearchParam('q');
32+
const ReOrdering = useMemo(() => {
33+
return (props) => {
34+
if (searchQuery || sorting || filter.some(v => v))
35+
return <div className="reordering"></div>;
36+
return (
37+
<DroppableArea
38+
id={`reorder:${props.id}:${props.folderId}`}
39+
dragging={props.dragging}
40+
className="reordering"
41+
>
42+
<div></div>
43+
</DroppableArea>
44+
);
45+
};
46+
}, []);
2347

2448
useEffect(() => {
2549
if (!event)
@@ -73,6 +97,7 @@ export function DraggableItem(props) {
7397
<div ref={setNodeRef} {...listeners} {...attributes}>
7498
{props.children}
7599
</div>
100+
<ReOrdering {...props}></ReOrdering>
76101
</li>
77102
);
78103
}
@@ -164,7 +189,7 @@ export function ListItem(props) {
164189
}
165190

166191
switch (props.layout) {
167-
case 'tiles': case 'mosaic':
192+
case 'tiles':
168193
return (
169194
<figure className="figure">
170195
<FigBody {...props}>
@@ -179,6 +204,21 @@ export function ListItem(props) {
179204
</figcaption>
180205
</figure>
181206
);
207+
case 'mosaic':
208+
return (
209+
<Tooltip>
210+
<TooltipTrigger>
211+
<div className="figure">
212+
<FigBody {...props}>
213+
<FigureLabels labels={props.labels}>
214+
<img src={props.thumbnail_url} {...props.listeners} {...props.attributes} />
215+
</FigureLabels>
216+
</FigBody>
217+
</div>
218+
</TooltipTrigger>
219+
<TooltipContent>{props.name}</TooltipContent>
220+
</Tooltip>
221+
);
182222
case 'list':
183223
return (<>
184224
<div className="figure">

0 commit comments

Comments
 (0)