Skip to content

fix: Relect template block structure of Django 5.2+ #1523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 34 additions & 22 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import sys


sys.path.append(os.path.abspath('../'))
sys.path.append(os.path.abspath("../"))

from filer import __version__ # NOQA

Expand All @@ -33,38 +33,38 @@
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinxcontrib.spelling',
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinxcontrib.spelling",
"sphinx_copybutton",
"sphinxext.opengraph",
'sphinxcontrib.images',
"sphinxcontrib.images",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = 'django-filer'
copyright = '%s, Stefan Foulis' % (datetime.date.today().year,)
project = "django-filer"
copyright = "%s, Stefan Foulis" % (datetime.date.today().year,)

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '.'.join(__version__.split('.')[0:2])
version = ".".join(__version__.split(".")[:2])
# The full version, including alpha/beta/rc tags.
release = __version__

Expand All @@ -80,7 +80,7 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build', '_images', 'README.rst']
exclude_patterns = ["_build", "_images", "README.rst"]

# The reST default role (used for this markup: `text`) to use for all documents.
# default_role = None
Expand All @@ -97,7 +97,7 @@
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
Expand All @@ -107,7 +107,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'furo'
html_theme = "furo"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -138,7 +138,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
Expand Down Expand Up @@ -182,7 +182,7 @@
# html_file_suffix = ''

# Output file base name for HTML help builder.
htmlhelp_basename = 'django-filerdoc'
htmlhelp_basename = "django-filerdoc"


# -- Options for LaTeX output --------------------------------------------------
Expand All @@ -196,7 +196,13 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'django-filer.tex', 'django-filer Documentation', 'Stefan Foulis', 'manual'),
(
"index",
"django-filer.tex",
"django-filer Documentation",
"Stefan Foulis",
"manual",
),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -228,13 +234,19 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'django-filer', 'django-filer Documentation', ['Stefan Foulis'], 1)
("index", "django-filer", "django-filer Documentation", ["Stefan Foulis"], 1)
]


# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'http://docs.python.org/': None}
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"django": (
"https://docs.djangoproject.com/en/stable/",
"https://docs.djangoproject.com/en/stable/objects.inv",
),
}

images_config = {
'override_image_directive': True,
"override_image_directive": True,
}
11 changes: 11 additions & 0 deletions docs/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
django>=4.2,<5
furo
restructuredtext-lint
sphinx<8
sphinx-autobuild
sphinx-copybutton
sphinxcontrib-images
sphinxcontrib-spelling
sphinxcontrib-inlinesyntaxhighlight
sphinxext-opengraph
pip-tools
171 changes: 61 additions & 110 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,113 +1,80 @@
#
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile requirements.txt
# pip-compile --output-file=requirements.txt requirements.in
#
--extra-index-url https://www.piwheels.org/simple

alabaster==0.7.12
# via
# -r requirements.txt
# sphinx
asgiref==3.5.0
# via
# -r requirements.txt
# django
# via sphinx
asgiref==3.8.1
# via django
babel==2.9.1
# via
# -r requirements.txt
# sphinx
# via sphinx
beautifulsoup4==4.10.0
# via
# -r requirements.txt
# furo
# via furo
build==1.2.2.post1
# via pip-tools
certifi==2021.10.8
# via
# -r requirements.txt
# requests
# via requests
charset-normalizer==2.0.12
# via
# -r requirements.txt
# requests
# via requests
click==8.1.8
# via pip-tools
colorama==0.4.4
# via
# -r requirements.txt
# sphinx-autobuild
django==3.2.12
# via -r requirements.txt
# via sphinx-autobuild
django==4.2.20
# via -r requirements.in
docutils==0.17.1
# via
# -r requirements.txt
# restructuredtext-lint
# sphinx
furo==2021.6.24b37
# via -r requirements.txt
# via -r requirements.in
idna==3.3
# via
# -r requirements.txt
# requests
# via requests
imagesize==1.3.0
# via
# -r requirements.txt
# sphinx
importlib-metadata==4.11.0
# via
# -r requirements.txt
# sphinx
# via sphinx
jinja2==3.0.3
# via
# -r requirements.txt
# sphinx
# via sphinx
livereload==2.6.3
# via
# -r requirements.txt
# sphinx-autobuild
# via sphinx-autobuild
markupsafe==2.0.1
# via
# -r requirements.txt
# jinja2
# via jinja2
packaging==21.3
# via
# -r requirements.txt
# build
# sphinx
pip-tools==7.4.1
# via -r requirements.in
pyenchant==3.2.2
# via
# -r requirements.txt
# sphinxcontrib-spelling
# via sphinxcontrib-spelling
pygments==2.11.2
# via
# -r requirements.txt
# sphinx
# via sphinx
pyparsing==3.0.7
# via packaging
pyproject-hooks==1.2.0
# via
# -r requirements.txt
# packaging
# build
# pip-tools
pytz==2021.3
# via
# -r requirements.txt
# babel
# django
# via babel
requests==2.27.1
# via
# -r requirements.txt
# sphinx
# sphinxcontrib-images
restructuredtext-lint==1.3.2
# via -r requirements.txt
# via -r requirements.in
six==1.16.0
# via
# -r requirements.txt
# livereload
# via livereload
snowballstemmer==2.2.0
# via
# -r requirements.txt
# sphinx
# via sphinx
soupsieve==2.3.1
# via
# -r requirements.txt
# beautifulsoup4
# via beautifulsoup4
sphinx==4.4.0
# via
# -r requirements.txt
# -r requirements.in
# furo
# sphinx-autobuild
# sphinx-copybutton
Expand All @@ -116,54 +83,38 @@ sphinx==4.4.0
# sphinxcontrib-spelling
# sphinxext-opengraph
sphinx-autobuild==2021.3.14
# via -r requirements.txt
# via -r requirements.in
sphinx-copybutton==0.5.0
# via -r requirements.txt
# via -r requirements.in
sphinxcontrib-applehelp==1.0.2
# via
# -r requirements.txt
# sphinx
# via sphinx
sphinxcontrib-devhelp==1.0.2
# via
# -r requirements.txt
# sphinx
# via sphinx
sphinxcontrib-htmlhelp==2.0.0
# via
# -r requirements.txt
# sphinx
# via sphinx
sphinxcontrib-images==0.9.4
# via -r requirements.txt
# via -r requirements.in
sphinxcontrib-inlinesyntaxhighlight==0.2
# via -r requirements.txt
# via -r requirements.in
sphinxcontrib-jsmath==1.0.1
# via
# -r requirements.txt
# sphinx
# via sphinx
sphinxcontrib-qthelp==1.0.3
# via
# -r requirements.txt
# sphinx
# via sphinx
sphinxcontrib-serializinghtml==1.1.5
# via
# -r requirements.txt
# sphinx
# via sphinx
sphinxcontrib-spelling==7.3.2
# via -r requirements.txt
# via -r requirements.in
sphinxext-opengraph==0.5.1
# via -r requirements.txt
# via -r requirements.in
sqlparse==0.4.2
# via
# -r requirements.txt
# django
# via django
tornado==6.1
# via
# -r requirements.txt
# livereload
# via livereload
urllib3==1.26.8
# via
# -r requirements.txt
# requests
zipp==3.7.0
# via
# -r requirements.txt
# importlib-metadata
# via requests
wheel==0.45.1
# via pip-tools

# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
6 changes: 5 additions & 1 deletion filer/admin/folderadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ class FolderAdmin(PrimitivePermissionAwareModelAdmin):
actions = ['delete_files_or_folders', 'move_files_and_folders',
'copy_files_and_folders', 'resize_images', 'rename_files']

directory_listing_template = 'admin/filer/folder/directory_listing.html'
if DJANGO_VERSION >= (5, 2):
directory_listing_template = 'admin/filer/folder/directory_listing.html'
else: # Remove this when Django 5.2 is the minimum version
directory_listing_template = 'admin/filer/folder/legacy_listing.html'

order_by_file_fields = ['_file_size', 'original_filename', 'name', 'owner',
'uploaded_at', 'modified_at']

Expand Down
Loading
Loading