updated formatter and docs

This commit is contained in:
Christopher Pickering 2021-07-29 13:41:34 -05:00
parent 558b3b3cf4
commit 9120f70147
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
705 changed files with 61642 additions and 382 deletions

View file

@ -1,2 +1,2 @@
include pyproject.toml include pyproject.toml
include rules.yaml include src/djlint/rules.yaml

View file

@ -1,114 +1,41 @@
djlint djLint
====== ======
Simple Django template linter and reformatter. Ps, reformatting might Simple html template linter and reformatter to find common formatting issues with and *reformat* django html templates
work with Jinja and Handlebar templates as well! Test it out with the
``--check`` flag. Ps, ``--check`` it out on Jinja and Handlebar templates as well!
|codecov| |test| |Codacy Badge| |Maintainability| |codecov| |test| |Codacy Badge| |Maintainability|
Install from `Pypi <https://pypi.org/project/djlint/>`__
--------------------------------------------------------
.. code:: sh Documentation
pip install djlint
Linter Usage
------------
.. code:: sh
djlint src # file or path
# with custom extensions
djlint src -e html.dj
Reformatter Usage
-----------------
Reforamtting is beta. Check the output before applying changes. Please
PR any changes needed 👍🏽
.. code:: sh
djlint src --reformat --check
djlint src --reformat
Optional args
------------- -------------
+--------------------+---------------------------+----------------+ Read the `documentation <https://djlint.readthedocs.io>`_
| Arg | Definition | Default |
+====================+===========================+================+
| -e, --extension | File extension to lint. | default=html |
+--------------------+---------------------------+----------------+
| --reformat --check | Checks html formatting | |
+--------------------+---------------------------+----------------+
| --reformat | Reformats html | |
+--------------------+---------------------------+----------------+
Linter Rules Show your format
------------ ----------------
Error Codes Add a badge to your projects `readme.md`:
~~~~~~~~~~~
+--------+----------------------------------------------------------------------+ .. code-block:: md
| Code | Meaning |
+========+======================================================================+
| E001 | Variables should be wrapped in a single whitespace. Ex: {{ this }} |
+--------+----------------------------------------------------------------------+
| E002 | Double quotes should be used in tags. Ex {% extends "this.html" %} |
+--------+----------------------------------------------------------------------+
Warning Codes [![Code style: black](https://img.shields.io/badge/html%20style-djlint-blue.svg)](https://github.com/Riverside-Healthcare/djlint)
~~~~~~~~~~~~~
+--------+----------------------------------------------------------------+
| Code | Meaning |
+========+================================================================+
| W003 | Endblock should have name. Ex: {% endblock body %}. |
+--------+----------------------------------------------------------------+
| W004 | Status urls should follow {% static path/to/file %} pattern. |
+--------+----------------------------------------------------------------+
| W005 | Html tag should have lang attribute. |
+--------+----------------------------------------------------------------+
| W006 | Img tag should have alt, height and width attributes. |
+--------+----------------------------------------------------------------+
| W007 | <!DOCTYPE ... > should be present before the html tag. |
+--------+----------------------------------------------------------------+
| W008 | Attributes should be double quoted. |
+--------+----------------------------------------------------------------+
| W009 | Tag names should be lowercase. |
+--------+----------------------------------------------------------------+
| W010 | Attribute names should be lowercase. |
+--------+----------------------------------------------------------------+
| W011 | Attirbute values should be quoted. |
+--------+----------------------------------------------------------------+
| W012 | There should be no spaces around attribute =. |
+--------+----------------------------------------------------------------+
| W013 | Line is longer than 99 chars. |
+--------+----------------------------------------------------------------+
| W014 | More than 2 blank lines. |
+--------+----------------------------------------------------------------+
| W015 | Follow h tags with a blank line. |
+--------+----------------------------------------------------------------+
| W016 | Missging title tag in html. |
+--------+----------------------------------------------------------------+
| W017 | Tag should be self closing. |
+--------+----------------------------------------------------------------+
Adding Rules Add a badge to your `readme.rst`:
------------
A good rule consists of .. code-block:: rst
.. image:: https://img.shields.io/badge/html%20style-djlint-blue.svg
:target: https://github.com/Riverside-Healthcare/djlint
Looks like this:
.. image:: https://img.shields.io/badge/html%20style-djlint-blue.svg
:target: https://github.com/Riverside-Healthcare/djlint
- Name
- Code - Codes beginning with "E" signify error, and "W" warning.
- Message - Message to display when error is found.
- Patterns - regex expressions that will find the error.
Contributing - Please Help! Contributing - Please Help!
--------------------------- ---------------------------

BIN
docs/_static/icon.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -38,14 +38,14 @@ html_sidebars = {
html_theme_options = { html_theme_options = {
"show_related": False, "show_related": False,
"description": "django template formatter", "description": "Html Template Lint",
"github_button": True, "github_button": True,
"github_user": "Riverside-Healthcare", "github_user": "Riverside-Healthcare",
"github_repo": "djlint", "github_repo": "djlint",
"github_type": "star", "github_type": "star",
"show_powered_by": False, "show_powered_by": False,
"fixed_sidebar": True, "fixed_sidebar": True,
# "logo": "logo2.png", "logo": "icon.png",
} }
html_static_path = ["_static"] html_static_path = ["_static"]

View file

@ -0,0 +1,6 @@
Configuration
=============
Help needed!
Ideally we'd like to be able to ignore rules through pyproject.toml, or cli.

51
docs/djlint/formatter.rst Normal file
View file

@ -0,0 +1,51 @@
Formatter
=========
djLint's formatter will take sloppy html templates and make it look pretty nice!
For an example of what the output will be, check out the `/tests/` folder to see over 300 **formatted** templates from the top django and flask projects.
Before
------
.. code :: html
{% load admin_list %} {% load i18n %}
<p class="paginator">
{% if pagination_required %}
{% for i in page_range %} {% paginator_number cl i %}
{% endfor %} {% endif %}
{{ cl.result_count }}
{% if cl.result_count == 1 %}{{ cl.opts.verbose_name }} {% else %}
{{ cl.opts.verbose_name_plural }} {% endif %}
{% if show_all_url %} <a href="{{ show_all_url }}" class="showall">{% translate 'Show all' %}
</a>
{% endif %}{% if cl.formset and cl.result_count %}<input type="submit" name="_save" class="default" value="{% translate 'Save' %}">{% endif %}
</p>
After
-----
.. code :: html
{% load admin_list %}
{% load i18n %}
<p class="paginator">
{% if pagination_required %}
{% for i in page_range %}
{% paginator_number cl i %}
{% endfor %}
{% endif %}
{{ cl.result_count }}
{% if cl.result_count == 1 %}
{{ cl.opts.verbose_name }}
{% else %}
{{ cl.opts.verbose_name_plural }}
{% endif %}
{% if show_all_url %}
<a href="{{ show_all_url }}" class="showall">
{% translate 'Show all' %}
</a>
{% endif %}
{% if cl.formset and cl.result_count %}
<input type="submit" name="_save" class="default" value="{% translate 'Save' %}">
{% endif %}
</p>

60
docs/djlint/rules.rst Normal file
View file

@ -0,0 +1,60 @@
Linter Rules
============
Error Codes
~~~~~~~~~~~
+--------+----------------------------------------------------------------------+
| Code | Meaning |
+========+======================================================================+
| E001 | Variables should be wrapped in a single whitespace. Ex: {{ this }} |
+--------+----------------------------------------------------------------------+
| E002 | Double quotes should be used in tags. Ex {% extends "this.html" %} |
+--------+----------------------------------------------------------------------+
Warning Codes
~~~~~~~~~~~~~
+--------+----------------------------------------------------------------+
| Code | Meaning |
+========+================================================================+
| W003 | Endblock should have name. Ex: {% endblock body %}. |
+--------+----------------------------------------------------------------+
| W004 | Status urls should follow {% static path/to/file %} pattern. |
+--------+----------------------------------------------------------------+
| W005 | Html tag should have lang attribute. |
+--------+----------------------------------------------------------------+
| W006 | Img tag should have alt, height and width attributes. |
+--------+----------------------------------------------------------------+
| W007 | <!DOCTYPE ... > should be present before the html tag. |
+--------+----------------------------------------------------------------+
| W008 | Attributes should be double quoted. |
+--------+----------------------------------------------------------------+
| W009 | Tag names should be lowercase. |
+--------+----------------------------------------------------------------+
| W010 | Attribute names should be lowercase. |
+--------+----------------------------------------------------------------+
| W011 | Attirbute values should be quoted. |
+--------+----------------------------------------------------------------+
| W012 | There should be no spaces around attribute =. |
+--------+----------------------------------------------------------------+
| W013 | Line is longer than 120 chars. |
+--------+----------------------------------------------------------------+
| W014 | More than 2 blank lines. |
+--------+----------------------------------------------------------------+
| W015 | Follow h tags with a blank line. |
+--------+----------------------------------------------------------------+
| W016 | Missging title tag in html. |
+--------+----------------------------------------------------------------+
| W017 | Tag should be self closing. |
+--------+----------------------------------------------------------------+
Adding Rules
------------
A good rule consists of
- Name
- Code - Codes beginning with "E" signify error, and "W" warning.
- Message - Message to display when error is found.
- Patterns - regex expressions that will find the error.

54
docs/djlint/usage.rst Normal file
View file

@ -0,0 +1,54 @@
Getting Started
================
Installation from `Pypi <https://pypi.org/project/djlint/>`__
--------------------------------------------------------------
.. code:: sh
pip install djlint
Linter Usage
------------
.. code:: sh
djlint src # file or path
# with custom extensions
djlint src -e html.dj
Reformatter Usage
-----------------
Reforamtting is a beta product. Check the output before applying changes.
Reformatting does not work with long json/html embedded into attribute data.
To check what may change in formatting run:
.. code:: sh
djlint src --check
To reformat run:
.. code:: sh
djlint src --reformat
CLI Args
-------------
.. code:: sh
Usage: djlint [OPTIONS] SRC ...
Djlint django template files.
Options:
-e, --extension TEXT File extension to lint [default: html]
--reformat Reformat the file(s).
--check Check formatting on the file(s).
--quiet Do not print diff when reformatting.
-h, --help Show this message and exit.

View file

@ -1,12 +1,17 @@
.. djlint documentation master file, created by .. djlint documentation master file, created by
sphinx-quickstart on Tue Jul 27 15:28:35 2021. sphinx-quickstart on Tue Jul 27 15:28:35 2021.
Django Template Formatter Html Template Linter and Formatter
========================= ==================================
.. toctree:: .. toctree::
:maxdepth: 2 :hidden:
:caption: Contents: :glob:
:maxdepth: 1
:titlesonly:
Welcome<self>
djlint/*
.. toctree:: .. toctree::
:hidden: :hidden:
@ -15,5 +20,48 @@ Django Template Formatter
PyPI ↪ <https://pypi.org/project/djlint/> PyPI ↪ <https://pypi.org/project/djlint/>
.. include:: ../readme.rst Simple html template linter and reformatter to find common formatting issues with and *reformat* django html templates
:start-line: 1
Ps, ``--check`` it out on Jinja and Handlebar templates as well!
|codecov| |test| |Codacy Badge| |Maintainability|
.. note:: djLint is not an html parser or syntax validator.
Show your format
----------------
Add a badge to your projects `readme.md`:
.. code-block:: md
[![Code style: black](https://img.shields.io/badge/html%20style-djlint-blue.svg)](https://github.com/Riverside-Healthcare/djlint)
Add a badge to your `readme.rst`:
.. code-block:: rst
.. image:: https://img.shields.io/badge/html%20style-djlint-blue.svg
:target: https://github.com/Riverside-Healthcare/djlint
Looks like this:
.. image:: https://img.shields.io/badge/html%20style-djlint-blue.svg
:target: https://github.com/Riverside-Healthcare/djlint
Contributing - Please Help!
---------------------------
Checkout the `issue <https://github.com/Riverside-Healthcare/djlint/issues>`_ list and help where you can!
.. |codecov| image:: https://codecov.io/gh/Riverside-Healthcare/djlint/branch/master/graph/badge.svg?token=eNTG721BAA
:target: https://codecov.io/gh/Riverside-Healthcare/djlint
.. |test| image:: https://github.com/Riverside-Healthcare/djlint/actions/workflows/test.yml/badge.svg
:target: https://github.com/Riverside-Healthcare/djlint/actions/workflows/test.yml
.. |Codacy Badge| image:: https://app.codacy.com/project/badge/Grade/dba6338b0e7a4de896b45b382574f369
:target: https://www.codacy.com/gh/Riverside-Healthcare/djlint/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Riverside-Healthcare/djlint&utm_campaign=Badge_Grade
.. |Maintainability| image:: https://api.codeclimate.com/v1/badges/5febe4111a36c7e0d2ed/maintainability
:target: https://codeclimate.com/github/Riverside-Healthcare/djlint/maintainability

View file

@ -22,4 +22,4 @@ quiet = true
[tool.pylint.messages_control] [tool.pylint.messages_control]
disable = "E1120, R0914, E0401, R0912" disable = "E1120, R0914, E0401, R0912, R0916"

View file

@ -12,7 +12,7 @@ __version__ = "0.1.1"
def long_description(): def long_description():
"""Build long description from readme and changelog.""" """Build long description from readme and changelog."""
return ( return (
(project_path / "README.md").read_text(encoding="utf8") (project_path / "README.rst").read_text(encoding="utf8")
+ "\n\n" + "\n\n"
+ (project_path / "CHANGELOG.md").read_text(encoding="utf8") + (project_path / "CHANGELOG.md").read_text(encoding="utf8")
) )
@ -31,7 +31,7 @@ setup(
author_email="cpickering@rhc.net", author_email="cpickering@rhc.net",
description="Django Template Linter", description="Django Template Linter",
long_description=long_description(), long_description=long_description(),
long_description_content_type="text/markdown", long_description_content_type="text/rst",
url="https://github.com/Riverside-Healthcare/djlint", url="https://github.com/Riverside-Healthcare/djlint",
include_package_data=True, include_package_data=True,
package_data={"djlint": ["rules.yaml"]}, package_data={"djlint": ["rules.yaml"]},
@ -43,7 +43,12 @@ setup(
package_dir={"": "src"}, package_dir={"": "src"},
packages=find_packages(where="src"), packages=find_packages(where="src"),
python_requires=">=3.6", python_requires=">=3.6",
install_requires=["click>=7.1.2", "pyyaml>=5.4.1", "colorama>=0.4.3"], install_requires=[
"click>=7.1.2",
"pyyaml>=5.4.1",
"colorama>=0.4.3",
"regex>=2020.11.13",
],
test_suite="tests.test_djlint", test_suite="tests.test_djlint",
entry_points={ entry_points={
"console_scripts": [ "console_scripts": [

View file

@ -4,10 +4,11 @@ Check Django template syntax.
usage:: usage::
djlint INPUT -e <extension> djlint src
options: options:
-e or --extension | <extension>
--check | will check html formatting for needed changes --check | will check html formatting for needed changes
--reformat | will reformat html --reformat | will reformat html
@ -24,9 +25,9 @@ import click
from click import echo from click import echo
from colorama import Fore, Style, deinit, init from colorama import Fore, Style, deinit, init
from djlint.lint import lint_file from .lint import lint_file
from djlint.reformat import reformat_file from .reformat import reformat_file
from djlint.settings import ignored_paths from .settings import ignored_paths
def get_src(src: Path, extension=None): def get_src(src: Path, extension=None):
@ -149,17 +150,17 @@ def build_quantity_tense(size: int):
@click.option( @click.option(
"--reformat", "--reformat",
is_flag=True, is_flag=True,
help="Reformat the file.", help="Reformat the file(s).",
) )
@click.option( @click.option(
"--check", "--check",
is_flag=True, is_flag=True,
help="Reformat the file.", help="Check formatting on the file(s).",
) )
@click.option( @click.option(
"--quiet", "--quiet",
is_flag=True, is_flag=True,
help="Reformat the file.", help="Do not print diff when reformatting.",
) )
def main(src: str, extension: str, reformat: bool, check: bool, quiet: bool): def main(src: str, extension: str, reformat: bool, check: bool, quiet: bool):
"""Djlint django template files.""" """Djlint django template files."""
@ -192,7 +193,7 @@ def main(src: str, extension: str, reformat: bool, check: bool, quiet: bool):
worker_count = min(worker_count, 60) worker_count = min(worker_count, 60)
with ProcessPoolExecutor(max_workers=worker_count) as exe: with ProcessPoolExecutor(max_workers=worker_count) as exe:
if reformat is True: if reformat is True or check is True:
func = partial(reformat_file, check) func = partial(reformat_file, check)
file_errors = exe.map(func, file_list) file_errors = exe.map(func, file_list)
else: else:
@ -202,16 +203,8 @@ def main(src: str, extension: str, reformat: bool, check: bool, quiet: bool):
success_message = "" success_message = ""
error_count = 0 error_count = 0
if reformat is not True: if reformat is True or check is True:
for error in file_errors: # reformat message
error_count += build_output(error)
success_message = "%sed %s, found %d errors." % (
message,
file_quantity,
error_count,
)
else:
for error in file_errors: for error in file_errors:
error_count += build_check_output(error, quiet) error_count += build_check_output(error, quiet)
tense_message = ( tense_message = (
@ -221,6 +214,17 @@ def main(src: str, extension: str, reformat: bool, check: bool, quiet: bool):
) )
success_message = "%s updated." % tense_message success_message = "%s updated." % tense_message
else:
# lint message
for error in file_errors:
error_count += build_output(error)
success_message = "%sed %s, found %d errors." % (
message,
file_quantity,
error_count,
)
echo("\n%s\n" % (success_message)) echo("\n%s\n" % (success_message))

View file

@ -0,0 +1 @@
# flake8:noqa

View file

@ -0,0 +1,116 @@
"""djLint Attempt to logically shrink html."""
import regex as re
from ..settings import (
ignored_inline_blocks,
ignored_tag_closing,
ignored_tag_opening,
single_line_html_tags,
single_line_template_tags,
start_template_tags,
tag_raw_flat_closing,
tag_raw_flat_opening,
)
def _clean_line(line):
"""Clean up a line of html.
* remove duplicate spaces
* remove trailing spaces
"""
return re.sub(r" {2,}", " ", line.strip())
def _strip_html_whitespace(html):
"""Remove unnecessary whitespace from text."""
rawcode_flat = ""
is_block_ignored = False
is_block_raw = False
for item in html.strip().splitlines():
# start of ignored block
is_block_raw = bool(re.search(tag_raw_flat_opening, item, re.IGNORECASE))
# find ignored blocks and retain indentation, otherwise strip white space
if re.findall(
r"(?:%s)" % "|".join(ignored_inline_blocks), item, flags=re.IGNORECASE
):
tmp = _clean_line(item)
elif (
re.search(ignored_tag_closing, item, re.IGNORECASE)
and is_block_raw is False
):
tmp = _clean_line(item)
is_block_ignored = False
elif (
re.search(ignored_tag_opening, item, re.IGNORECASE)
and is_block_raw is False
):
tmp = _clean_line(item)
is_block_ignored = True
elif is_block_raw or is_block_ignored:
tmp = item
else:
tmp = _clean_line(item)
# end of ignore raw code
is_block_raw = not bool(re.search(tag_raw_flat_closing, item, re.IGNORECASE))
rawcode_flat = rawcode_flat + tmp + "\n"
return rawcode_flat
def compress_html(html):
"""Compress back tags that do not need to be expanded."""
# put empty tags on one line
html = re.sub(
r"(<([\w]+)[^>]*>)\s+?(<\/\2>)",
r"\1\3",
html,
flags=re.IGNORECASE | re.MULTILINE,
)
# put empty template tags on one line
html = re.sub(
r"(" + start_template_tags + r")\s+?(\{\% end[^}]*?\%\})",
r"\1\2",
html,
re.MULTILINE,
)
# put short single line tags on one line
slt_html = "|".join(single_line_html_tags)
html = re.sub(
r"(<(%s)>)\s*([^<\n]{,80})\s*?(</(\2)>)" % slt_html,
r"\1\3\4",
html,
re.IGNORECASE | re.MULTILINE,
)
html = re.sub(
r"(<(%s) [^\n]{,30}>)\s*([^<\n]{,50})\s*?(</(\2)>)" % slt_html,
r"\1\3\4",
html,
re.IGNORECASE | re.MULTILINE,
)
slt_template = "|".join(single_line_template_tags)
html = re.sub(
r"({% +?("
+ slt_template
+ r") +?[^\n]{,30}%})\s*([^%\n]{,50})\s*?({% +?end(\2) +?%})",
r"\1\3\4",
html,
re.IGNORECASE | re.MULTILINE,
)
html = _strip_html_whitespace(html)
return html

View file

@ -0,0 +1,201 @@
"""djLint expand out html code."""
from functools import partial
import regex as re
from ..settings import (
break_html_tags,
break_template_tags,
ignored_attributes,
ignored_blocks,
tag_pattern,
)
def _flatten_attributes(match):
"""Flatten multiline attributes back to one line.
Skip when attribute is ignored.
Attribute name can be in group one or group 2.
for now, skipping if they are anywhere
"""
for attribute in ignored_attributes:
if attribute in match.group():
return match.group()
return "{} {}{}".format(
match.group(1),
" ".join(match.group(2).strip().splitlines()),
match.group(3),
)
def _should_ignore(html, match):
"""Do not add whitespace if the tag is in a non indent block."""
for block in ignored_blocks:
return any(
ignored_match.start() < match.start(1)
and ignored_match.end() > match.end(1)
for ignored_match in re.finditer(
block % re.escape(match.group(1)), html, re.DOTALL | re.IGNORECASE
)
)
return False
def expand_html(html):
"""Split single line html into many lines based on tags."""
def add_html_line(out_format, match):
"""Add whitespace.
Do not add whitespace if the tag is in a non indent block.
"""
if _should_ignore(html, match):
return match.group(1)
return out_format % match.group(1)
# put attributes on one line
html = re.sub(
tag_pattern,
_flatten_attributes,
html,
flags=re.IGNORECASE | re.DOTALL | re.MULTILINE,
)
html_tags = "|".join(break_html_tags)
# process opening tags ############
# the tag either closes <div>
# self closes <img />
# has attributes <div text>
# or has attributes and self closes <img text/>
add_left = partial(add_html_line, "\n%s")
add_right = partial(add_html_line, "%s\n")
break_char = r"(?<!\n *?)"
html = re.sub(
r"%s\K(<(?:%s)>)"
% (
break_char,
html_tags,
),
add_left,
html,
flags=re.IGNORECASE,
)
html = re.sub(
r"(<(?:%s)>)(?=[^\n])" % html_tags, add_right, html, flags=re.IGNORECASE
)
html = re.sub(
r"%s\K(<(?:%s) ?/>)"
% (
break_char,
html_tags,
),
add_left,
html,
flags=re.IGNORECASE,
)
html = re.sub(
r"(<(?:%s) ?/>)(?=[^\n])" % html_tags, add_right, html, flags=re.IGNORECASE
)
html = re.sub(
r"%s\K(<(?:%s) [^>]*?[^/]>)"
% (
break_char,
html_tags,
),
add_left,
html,
flags=re.IGNORECASE,
)
html = re.sub(
r"(<(?:%s) [^>]*?[^/]>)(?=[^\n])" % html_tags,
add_right,
html,
flags=re.IGNORECASE,
)
html = re.sub(
r"%s\K(<(?:%s) [^>]+?/>)"
% (
break_char,
html_tags,
),
add_left,
html,
flags=re.IGNORECASE,
)
html = re.sub(
r"(<(?:%s) [^>]+?/>)(?=[^\n])" % html_tags, add_right, html, flags=re.IGNORECASE
)
# process closing (break_char, html_tags,)s ######
html = re.sub(
r"%s\K(</(?:%s)>)"
% (
break_char,
html_tags,
),
add_left,
html,
flags=re.IGNORECASE,
)
html = re.sub(
r"(</(?:%s)>)(?=[^\n])" % html_tags, add_right, html, flags=re.IGNORECASE
)
# template tag breaks
def should_i_move_template_tag(out_format, match):
# ensure template tag is not inside an html tag
html_tags = "|".join(break_html_tags)
if _should_ignore(html, match):
return match.group(1)
if not re.findall(
r"\<(?:"
+ html_tags
+ r") .*? ?\w+=[\"][^\"]*?"
+ re.escape(match.group(1))
+ "$",
html[: match.end()],
re.MULTILINE,
):
return out_format % match.group(1)
return match.group(1)
for tag in break_template_tags:
# find all matching tags
html = re.sub(
r"%s\K(%s)"
% (
break_char,
tag,
),
partial(should_i_move_template_tag, "\n%s"),
html,
re.IGNORECASE | re.MULTILINE,
)
html = re.sub(
r"(%s)(?=[^\n])" % tag,
partial(should_i_move_template_tag, "%s\n"),
html,
re.IGNORECASE | re.MULTILINE,
)
return html

View file

@ -0,0 +1,163 @@
"""djLint add indentation to html."""
import regex as re
from ..settings import (
always_single_line_html_tags,
attribute_pattern,
break_html_tags,
format_long_attributes,
ignored_inline_blocks,
ignored_tag_closing,
ignored_tag_opening,
indent,
max_line_length,
reduce_extralines_gt,
single_line_template_tags,
tag_indent,
tag_raw_flat_closing,
tag_raw_flat_opening,
tag_unindent,
tag_unindent_line,
)
def _format_attributes(match):
"""Spread long attributes over multiple lines."""
leading_space = match.group(1)
tag = match.group(2)
spacing = "\n" + leading_space + len(tag) * " "
attributes = (spacing).join(re.findall(attribute_pattern, match.group(3).strip()))
close = match.group(4)
return "{}{}{}{}".format(
leading_space,
tag,
attributes,
close,
)
def indent_html(rawcode):
"""Indent raw code."""
rawcode_flat_list = re.split("\n", rawcode)
beautified_code = ""
indent_level = 0
is_block_raw = False
blank_counter = 0
slt_html = "|".join(
break_html_tags
) # here using all tags cause we allow empty tags on one line
always_slt_html = "|".join(
always_single_line_html_tags
) # here using all tags cause we allow empty tags on one line
slt_template = "|".join(single_line_template_tags)
for item in rawcode_flat_list:
# if a raw tag then start ignoring
if (
tag_raw_flat_opening
and re.search(tag_raw_flat_opening, item, re.IGNORECASE)
) or re.search(tag_raw_flat_opening, item, re.IGNORECASE):
is_block_raw = True
if re.findall(
r"(?:%s)" % "|".join(ignored_inline_blocks), item, flags=re.IGNORECASE
):
tmp = (indent * indent_level) + item + "\n"
# if a one-line, inline tag, just process it, only if line starts w/ it
elif (
re.findall(r"(<(%s)>)(.*?)(</(\2)>)" % slt_html, item, re.IGNORECASE)
or re.findall(r"(<(%s) .+?>)(.*?)(</(\2)>)" % slt_html, item, re.IGNORECASE)
or re.findall(
r"({% +?(" + slt_template + r") +?.+?%})(.*?)({% +?end(\2) +?%})",
item,
re.IGNORECASE,
)
or re.findall(r"(<(%s) .*?/>)" % slt_html, item, flags=re.IGNORECASE)
or re.findall(
r"(<(%s) .*?/?>)" % always_slt_html, item, flags=re.IGNORECASE
)
) and is_block_raw is False:
tmp = (indent * indent_level) + item + "\n"
blank_counter = 0
# if unindent, move left
elif (
re.search(r"^(?:" + tag_unindent + r")", item, re.IGNORECASE | re.MULTILINE)
and is_block_raw is False
or re.search(ignored_tag_closing, item, re.IGNORECASE)
):
indent_level = indent_level - 1
tmp = (indent * indent_level) + item + "\n"
blank_counter = 0
elif (
re.search(r"^" + tag_unindent_line, item, re.IGNORECASE | re.MULTILINE)
and is_block_raw is False
):
tmp = (indent * (indent_level - 1)) + item + "\n"
blank_counter = 0
# if indent, move right
elif (
re.search(r"^(?:" + tag_indent + r")", item, re.IGNORECASE | re.MULTILINE)
and is_block_raw is False
):
tmp = (indent * indent_level) + item + "\n"
indent_level = indent_level + 1
blank_counter = 0
elif is_block_raw is True:
tmp = item + "\n"
# if just a blank line
elif item.strip() == "" and (
blank_counter < int(reduce_extralines_gt) or blank_counter + 1
):
tmp = item.strip()
# otherwise, just leave same level
else:
tmp = (indent * indent_level) + item + "\n"
# we can try to fix django tags
tmp = re.sub(r"({[{|%])(\w[^}].+?)([}|%]})", r"\1 \2\3", tmp)
tmp = re.sub(r"({[{|%])([^}].+?[^ ])([}|%]})", r"\1\2 \3", tmp)
# handlebars templates
tmp = re.sub(r"({{#(?:each|if).+?[^ ])(}})", r"\1 \2", tmp)
# if a opening raw tag then start ignoring.. only if there is no closing tag
# on the same line
if (
tag_raw_flat_closing
and re.search(tag_raw_flat_opening, item, re.IGNORECASE)
) or re.search(ignored_tag_opening, item, re.IGNORECASE):
is_block_raw = True
# if a normal tag, we can try to expand attributes
elif (
format_long_attributes
and is_block_raw is False
and len(tmp) > max_line_length
):
# get leading space, and attributes
tmp = re.sub(r"(\s*?)(<\w+\s)([^>]+?)(/?>)", _format_attributes, tmp)
# turn off raw block if we hit end - for one line raw blocks
if (
tag_raw_flat_closing
and re.search(tag_raw_flat_closing, item, re.IGNORECASE)
) or re.search(ignored_tag_closing, item, re.IGNORECASE):
is_block_raw = False
beautified_code = beautified_code + tmp
return beautified_code.strip() + "\n"

View file

@ -4,246 +4,43 @@ Much code is borrowed from https://github.com/rareyman/HTMLBeautify, many thanks
""" """
import difflib import difflib
import re
from pathlib import Path from pathlib import Path
from djlint.settings import ( from .formatter.compress_html import compress_html
attribute_pattern, from .formatter.expand_html import expand_html
format_long_attributes, from .formatter.indent_html import indent_html
ignored_tag_closing,
ignored_tag_opening,
indent,
max_line_length,
reduce_extralines_gt,
tag_indent,
tag_newline_after,
tag_newline_before,
tag_pattern,
tag_pos_inline,
tag_raw_flat_closing,
tag_raw_flat_opening,
tag_unindent,
tag_unindent_line,
)
def clean_line(line):
"""Clean up a line of html.
* remove duplicate spaces
* remove trailing spaces
"""
return re.sub(r" {2,}", " ", line.strip())
def flatten_attributes(match):
"""Flatten multiline attributes back to one line."""
return "{} {}{}".format(
match.group(1),
" ".join(match.group(2).strip().splitlines()),
match.group(3),
)
def format_attributes(match):
"""Spread long attributes over multiple lines."""
leading_space = match.group(1)
tag = match.group(2)
attributes = "{}{}".format(
("\n" + leading_space + indent),
("\n" + leading_space + indent).join(
re.findall(attribute_pattern, match.group(3).strip())
),
)
close = match.group(4)
return "{}{}{}{}".format(
leading_space,
tag,
attributes,
close,
)
def add_newlines(match):
"""Only add newlines of the match is not in our acceptable one line pattern."""
g_one = match.group(1)
g_two = match.group(2)
if not re.search(tag_pos_inline, g_one + g_two, flags=re.IGNORECASE | re.MULTILINE):
return g_one + "\n" + g_two
return g_one + g_two
def remove_indentation(rawcode):
"""Remove indentation from raw code."""
rawcode_flat = ""
is_block_ignored = False
is_block_raw = False
for item in rawcode.strip().splitlines():
# ignore raw code
if re.search(tag_raw_flat_closing, item, re.IGNORECASE):
is_block_raw = False
elif re.search(tag_raw_flat_opening, item, re.IGNORECASE):
is_block_raw = True
# find ignored blocks and retain indentation, otherwise strip white space
if re.search(ignored_tag_closing, item, re.IGNORECASE):
tmp = clean_line(item)
is_block_ignored = False
elif re.search(ignored_tag_opening, item, re.IGNORECASE):
tmp = clean_line(item)
is_block_ignored = True
# not filtered so just output it
elif is_block_raw:
# remove tabs from raw_flat content
tmp = re.sub(indent, "", item)
elif is_block_ignored:
tmp = item
else:
tmp = clean_line(item) # item.strip()
# add missing line breaks before tag
tmp = re.sub(
tag_newline_before,
add_newlines,
tmp,
flags=re.IGNORECASE | re.MULTILINE,
)
# add missing line breaks after tag
tmp = re.sub(
tag_newline_after, add_newlines, tmp, flags=re.IGNORECASE | re.MULTILINE
)
rawcode_flat = rawcode_flat + tmp + "\n"
# put attributes back on one line
rawcode_flat = re.sub(
tag_pattern,
flatten_attributes,
rawcode_flat,
flags=re.IGNORECASE | re.DOTALL | re.MULTILINE,
)
# put empty tags on one line
rawcode_flat = re.sub(
r"(<([\w]+)[^>]*>)\n(<\/\2>)",
r"\1\3",
rawcode_flat,
flags=re.IGNORECASE | re.MULTILINE,
)
return rawcode_flat
def add_indentation(rawcode):
"""Indent raw code."""
rawcode_flat_list = re.split("\n", rawcode)
beautified_code = ""
indent_level = 0
is_block_raw = False
blank_counter = 0
for item in rawcode_flat_list:
# if a raw tag then start ignoring
if (
tag_raw_flat_closing
and re.search(tag_raw_flat_closing, item, re.IGNORECASE)
) or re.search(ignored_tag_closing, item, re.IGNORECASE):
is_block_raw = False
# if a one-line, inline tag, just process it
if re.search(tag_pos_inline, item, re.IGNORECASE) and is_block_raw is False:
tmp = (indent * indent_level) + item
blank_counter = 0
# if unindent, move left
elif re.search(tag_unindent, item, re.IGNORECASE) and is_block_raw is False:
indent_level = indent_level - 1
tmp = (indent * indent_level) + item
blank_counter = 0
elif (
re.search(tag_unindent_line, item, re.IGNORECASE) and is_block_raw is False
):
tmp = (indent * (indent_level - 1)) + item
blank_counter = 0
# if indent, move right
elif re.search(tag_indent, item, re.IGNORECASE) and is_block_raw is False:
tmp = (indent * indent_level) + item
indent_level = indent_level + 1
blank_counter = 0
elif is_block_raw is True:
tmp = item
# if just a blank line
elif item.strip() == "" and (
blank_counter < int(reduce_extralines_gt) or blank_counter + 1
):
tmp = item.strip()
# otherwise, just leave same level
else:
tmp = (indent * indent_level) + item
# if not raw, we can try to fix django tags
tmp = re.sub(r"({[{|%])(\w[^}].+?)([}|%]})", r"\1 \2\3", tmp)
tmp = re.sub(r"({[{|%])([^}].+?[^ ])([}|%]})", r"\1\2 \3", tmp)
# handlebars templates
tmp = re.sub(r"({{#(?:each|if).+?[^ ])(}})", r"\1 \2", tmp)
# if a opening raw tag then start ignoring.. only if there is no closing tag
# on the same line
if (
tag_raw_flat_closing
and re.search(tag_raw_flat_opening, item, re.IGNORECASE)
) or re.search(ignored_tag_opening, item, re.IGNORECASE):
is_block_raw = True
# if a normal tag, we can try to expand attributes
elif (
format_long_attributes
and is_block_raw is False
and len(tmp) > max_line_length
):
# get leading space, and attributes
tmp = re.sub(r"(\s*?)(<\w+)(\s[^>]+?)(/?>)", format_attributes, tmp)
# turn off raw block if we hit end - for one line raw blocks
if (
tag_raw_flat_closing
and re.search(tag_raw_flat_closing, item, re.IGNORECASE)
) or re.search(ignored_tag_closing, item, re.IGNORECASE):
is_block_raw = False
beautified_code = beautified_code + tmp + "\n"
return beautified_code.strip() + "\n"
def reformat_file(check: bool, this_file: Path): def reformat_file(check: bool, this_file: Path):
"""Reformat html file.""" """Reformat html file."""
rawcode = this_file.read_text(encoding="utf8") rawcode = this_file.read_text(encoding="utf8")
beautified_code = add_indentation(remove_indentation(rawcode)) itteration = 0
beautified_code = rawcode
while itteration < 10:
expanded = expand_html(rawcode)
compressed = compress_html(expanded)
indented = indent_html(compressed)
if (
len(
list(
difflib.unified_diff(
beautified_code.splitlines(), indented.splitlines()
)
)
)
== 0
):
beautified_code = indented
break
beautified_code = indented
itteration += 1
if check is not True: if check is not True:
# update the file # update the file

View file

@ -65,9 +65,9 @@
- <(?:(?!\{[%|{|#])[^\n])*=\s - <(?:(?!\{[%|{|#])[^\n])*=\s
- rule: - rule:
name: W013 name: W013
message: Line is longer than 99 chars. message: Line is longer than 120 chars.
patterns: patterns:
- "[^\n]{99,}" - "[^\n]{120,}"
- rule: - rule:
name: W014 name: W014
message: More than 2 blank lines. message: More than 2 blank lines.

View file

@ -5,20 +5,17 @@
# default indentation # default indentation
indent = " " indent = " "
break_html_tags = ["a", "abbr"]
# indicates tags whose contents should not be formatted # indicates tags whose contents should not be formatted
ignored_tag_opening = r"<script|<style|<!--|{\*|<\?php|<pre|<svg" ignored_tag_opening = r"<script|<style|<!--|{\*|<\?php|<pre|<svg|{#"
# indicates when to stop ignoring # indicates when to stop ignoring
ignored_tag_closing = r"</script|</style|-->|\*}|\?>|</pre|</svg" ignored_tag_closing = r"</script|</style|-->|\*}|\?>|</pre|</svg|#}"
# the contents of these tag blocks will be start on a new line
tag_newline_before = r"([^\n]+?)((?:(?:\{\{[\/|\#])|\{% +?(?:if|end|for|block|endblock|else|spaceless|compress|load|include|assets)|(?:<script)|(?:{% endverbatim %})|(?:{% verbatim %})|(?:</?(html|head|body|div|cache|a|nav|ul|ol|dl|li|table|thead|tbody|tr|th|td|blockquote|select|form|option|optgroup|fieldset|legend|label|header|main|section|aside|footer|figure|video|span|p|g|svg|button|img|source)[^>]*?>.*?)))"
# these tags should be followed by a newline
tag_newline_after = r"((?:(?:\{\{[\/\#].*?\}\})|\{% +?(?:if|end|for|block|else|spaceless|compress|load|include)(?:.*?%}))|(?:{% endverbatim %})|(?:{% verbatim %})|(?:<html|<head|</head|<body|</body|</script|<div|</div|<cache|</cache|<nav|</nav|<ul|</ul|<ol|</ol|<dl|</dl|<li|</li|<table|</table|<thead|</thead|<tbody|</tbody|<tr|</tr|<th|</th|<td|</td|<blockquote|</blockquote|<select|</select|<form|</form|<option|</option|<optgroup|</optgroup|<fieldset|</fieldset|<legend|</legend|<label|</label|<header|</header|<main|</main|<section|</section|<aside|</aside|<footer|</footer|<figure|</figure|<video|</video|<source|</source|</span|<p|</p|<g|</g|<svg|</svg|</h\d|<img).*?\>)([^\n]+)"
# the contents of these tag blocks will be indented # the contents of these tag blocks will be indented
tag_indent = r"(?:\{\{\#)|\{% +?(if|for|block|else|spaceless|compress)|(?:{% verbatim %})|(?:<(?:html|head|body|div|a|nav|ul|ol|dl|li|table|thead|tbody|tr|th|td|blockquote|select|form|option|cache|optgroup|fieldset|legend|label|header|main|section|aside|footer|figure|video|span|p|g|svg|h\d|button|img|script|style|source))" tag_indent = r"(?:\{\{\#)|\{% +?(if|for|block|else|spaceless|compress|addto|language)|(?:{% verbatim %})|(?:<(?:html|head|body|div|a|nav|ul|ol|dl|li|table|thead|tbody|tr|th|td|blockquote|select|form|option|cache|optgroup|fieldset|legend|label|header|main|section|aside|footer|figure|video|span|p|g|svg|h\d|button|img|script|style|source))"
# this signals when tags should be unindented (see tags above) # this signals when tags should be unindented (see tags above)
tag_unindent = r"(?:\{\{\/)|\{% end|(?:{% endverbatim %})|(?:</(?:html|head|body|div|a|nav|ul|ol|dl|li|table|thead|tbody|tr|th|td|blockquote|select|form|option|optgroup|fieldset|legend|label|header|cache|main|section|aside|footer|figure|video|span|p|g|svg|h\d|button|img|script|style|source))" tag_unindent = r"(?:\{\{\/)|\{% end|(?:{% endverbatim %})|(?:</(?:html|head|body|div|a|nav|ul|ol|dl|li|table|thead|tbody|tr|th|td|blockquote|select|form|option|optgroup|fieldset|legend|label|header|cache|main|section|aside|footer|figure|video|span|p|g|svg|h\d|button|img|script|style|source))"
@ -26,26 +23,198 @@ tag_unindent = r"(?:\{\{\/)|\{% end|(?:{% endverbatim %})|(?:</(?:html|head|body
# these tags should be unindented and next line will be indented # these tags should be unindented and next line will be indented
tag_unindent_line = r"(?:\{% el)|(?:\{\{ *?(?:else|\^) *?\}\})" tag_unindent_line = r"(?:\{% el)|(?:\{\{ *?(?:else|\^) *?\}\})"
# these tags can sometimes be on one line
tag_pos_inline = r"(?:<link.*/>|<link.*\">|<link.*>|<meta.*/>|<script.*</script>|<div[^>]*>[^<]*</div>|<a[^>]*>[^<]*</a>|<li[^>]*>[^<]*</li>|<dt[^>]*>[^<]*</dt>|<dd[^>]*>[^<]*</dd>|<th[^>]*>[^<]*</th>|<td[^>]*>[^<]*</td>|<legend[^>]*>[^<]*</legend>|<label[^>]*>[^<]*</label>|<option[^>]*>[^<]*</option>|<input.*/>|<input.*\">|<span[^>]*>[^<]*</span>|<p[^>]*>[^<]*</p>|<path.*/>|<!--.*-->|<button[^>]*>[^<]*</button>|<h\d[^>]*>[^<]*</h\d>|<img.*?/>)"
# these tags use raw code and should flatten to column 1 # these tags use raw code and should flatten to column 1
# tabs will be removed inside these tags! use spaces for spacing if needed! # tabs will be removed inside these tags! use spaces for spacing if needed!
# flatten starting with this tag... # flatten starting with this tag...
tag_raw_flat_opening = r"" tag_raw_flat_opening = r"{#"
# ...stop flattening when you encounter this tag # ...stop flattening when you encounter this tag
tag_raw_flat_closing = r"" tag_raw_flat_closing = r"#}"
# reduce empty lines greater than x to 1 line # reduce empty lines greater than x to 1 line
reduce_extralines_gt = 2 reduce_extralines_gt = 2
# if lines are longer than x # if lines are longer than x
max_line_length = 99 max_line_length = 120
format_long_attributes = True format_long_attributes = True
# pattern used to find attributes in a tag # pattern used to find attributes in a tag
attribute_pattern = r"(.+?=(?:\".*?\"|\'.*?\')|required|checked)\s*" attribute_pattern = r"(.+?=(?:\".*?\"|\'.*?\')|required|checked)\s*"
tag_pattern = r"(<\w+?)((?:\n\s*?[^>]+?)+?)(/?\>)" tag_pattern = r"(<\w+?[^>]*?)((?:\n\s*?[^>]+?)+?)(/?\>)"
ignored_attributes = [
"data-json",
]
ignored_paths = r"(?:\.tox|\.venv|node_modules|_build)" ignored_paths = r"(?:\.tox|\.venv|node_modules|_build)"
start_template_tags = r"{% ?(?:if|for|block|spaceless|compress|load|include|assets|addto|language)[^}]+?%}"
break_template_tags = [
r"{% ?(?:if|end|for|block|endblock|else|spaceless|compress|load|include|assets|addto|language)[^}]+?%}",
]
unformated_html_tags = ["script"]
ignored_blocks = [
r"<(script|style|pre|svg).*?(?:%s).*?</(\1)>",
r"<!--.*?(?:%s).*?-->",
r"{\*.*?(?:%s).*?\*}",
r"{#.*?(?:%s).*?#}",
r"<\?php.*?(?:%s).*?\?>",
]
ignored_inline_blocks = [
r"<!--.*?-->",
r"{\*.*?\*}",
r"{#.*?#}",
r"<\?php.*?\?>",
]
single_line_html_tags = [
"button",
"a",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"td",
"th",
"strong",
"em",
"icon",
"span",
"title",
"link",
]
always_single_line_html_tags = ["link"]
single_line_template_tags = ["if", "for", "block"]
break_html_tags = [
"a",
"abbr",
"acronym",
"address",
"applet",
"area",
"article",
"aside",
"audio",
"b",
"base",
"basefont",
"bdi",
"bdo",
"big",
"blockquote",
"body",
"br",
"button",
"canvas",
"caption",
"center",
"cite",
"code",
"col",
"colgroup",
"data",
"datalist",
"dd",
"del",
"details",
"dfn",
"dialog",
"dir",
"div",
"dl",
"dt",
"em",
"embed",
"fieldset",
"figcaption",
"figure",
"font",
"footer",
"form",
"frame",
"frameset",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"head",
"header",
"hr",
"html",
"i",
"iframe",
"img",
"input",
"ins",
"kbd",
"label",
"legend",
"li",
"link",
"main",
"map",
"mark",
"meta",
"meter",
"nav",
"noframes",
"noscript",
"object",
"ol",
"optgroup",
"option",
"output",
"p",
"param",
"picture",
"pre",
"progress",
"q",
"rp",
"rt",
"ruby",
"s",
"samp",
"script",
"section",
"select",
"small",
"source",
"span",
"strike",
"strong",
"style",
"sub",
"summary",
"sup",
"svg",
"table",
"tbody",
"td",
"template",
"textarea",
"tfoot",
"th",
"thead",
"time",
"title",
"tr",
"track",
"tt",
"u",
"ul",
"var",
"video",
"wbr",
]

View file

@ -1,10 +1,6 @@
My first name is {{htmlfirst_name }}. My last name is {{ last_name}}. My first name is {{ htmlfirst_name }}. My last name is {{ last_name }}.
{% extends 'base_generic.html" %} {% extends 'base_generic.html" %}
{% block body %} {% block body %}{% endblock %}
{% endblock%}
<link rel="stylesheet" href="/static/css/nav.scss" type="text/x-scss" charset="utf-8"/> <link rel="stylesheet" href="/static/css/nav.scss" type="text/x-scss" charset="utf-8"/>
<script type="text/javascript" src="/static/lib/markdown-it/markdown-it.js"></script> <script type="text/javascript" src="/static/lib/markdown-it/markdown-it.js"></script>
<img src="/static/images/hi.jpg" alt="Hi!"> <img src="/static/images/hi.jpg" alt="Hi!">

View file

@ -0,0 +1,11 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
{% block title %}
{% translate 'Page not found' %}
{% endblock %}
{% block content %}
<h2>{% translate 'Page not found' %}</h2>
<p>
{% translate 'Were sorry, but the requested page could not be found.' %}
</p>
{% endblock %}

View file

@ -0,0 +1,21 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
&rsaquo; {% translate 'Server error' %}
</div>
{% endblock %}
{% block title %}
{% translate 'Server error (500)' %}
{% endblock %}
{% block content %}
<h1>
{% translate 'Server Error
<em>(500)</em>
' %}
</h1>
<p>
{% translate 'Theres been an error. Its been reported to the site administrators via email and should be fixed shortly. Thanks for your patience.' %}
</p>
{% endblock %}

View file

@ -0,0 +1,44 @@
{% load i18n %}
<div class="actions">
{% block actions %}
{% block actions-form %}
{% for field in action_form %}
{% if field.label %}
<label>
{{ field.label }}
{% endif %}
{{ field }}
{% if field.label %}</label>{% endif %}
{% endfor %}
{% endblock %}
{% block actions-submit %}
<button type="submit"
class="button"
title="{% translate "
Run the selected action" %}" name="index"
value="{{ action_index|default:0 }}">
{% translate "Go" %}
</button>
{% endblock %}
{% block actions-counter %}
{% if actions_selection_counter %}
<span class="action-counter" data-actions-icnt="{{ cl.result_list|length }}">
{{ selection_note }}
</span>
{% if cl.result_count != cl.result_list|length %}
<span class="all hidden">{{ selection_note_all }}</span>
<span class="question hidden">
<a href="#" title="{% translate ">
{% blocktranslate with cl.result_count as total_count %}
Select all {{ total_count }} {{ module_name }}
{% endblocktranslate %}
</a>
</span>
<span class="clear hidden">
<a href="#">{% translate "Clear selection" %}</a>
</span>
{% endif %}
{% endif %}
{% endblock %}
{% endblock %}
</div>

View file

@ -0,0 +1,13 @@
{% extends "admin/index.html" %}
{% load i18n %}
{% block bodyclass %}{{ block.super }} app-{{ app_label }}{% endblock %}
{% if not is_popup %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
&rsaquo;
{% for app in app_list %}{{ app.name }}{% endfor %}
</div>
{% endblock %}
{% endif %}
{% block sidebar %}{% endblock %}

View file

@ -0,0 +1,63 @@
{% load i18n %}
{% if app_list %}
{% for app in app_list %}
<div class="app-{{ app.app_label }} module{% if app.app_url in request.path %}current-app{% endif %}">
<table>
<caption>
<a href="{{ app.app_url }}"
class="section"
title="{% blocktranslate with name=app.name %}Models in the {{ name }} application{% endblocktranslate %}">
{{ app.name }}
</a>
</caption>
{% for model in app.models %}
<tr class="model-{{ model.object_name|lower }}{% if model.admin_url in request.path %} current-model{% endif %}">
{% if model.admin_url %}
<th scope="row">
<a href="{{ model.admin_url }}"
{% if model.admin_url in request.path %}
aria-current="page"
{% endif %}
>
{{ model.name }}
</a>
</th>
{% else %}
<th scope="row">{{ model.name }}</th>
{% endif %}
{% if model.add_url %}
<td>
<a href="{{ model.add_url }}" class="addlink">
{% translate 'Add' %}
</a>
</td>
{% else %}
<td></td>
{% endif %}
{% if model.admin_url and show_changelinks %}
{% if model.view_only %}
<td>
<a href="{{ model.admin_url }}" class="viewlink">
{% translate 'View' %}
</a>
</td>
{% else %}
<td>
<a href="{{ model.admin_url }}" class="changelink">
{% translate 'Change' %}
</a>
</td>
{% endif %}
{% elif show_changelinks %}
<td></td>
{% endif %}
</tr>
{% endfor %}
</table>
</div>
{% endfor %}
{% else %}
<p>
{% translate 'You dont have permission to view or edit anything.' %}
</p>
{% endif %}

View file

@ -0,0 +1,13 @@
{% extends "admin/change_form.html" %}
{% load i18n %}
{% block form_top %}
{% if not is_popup %}
<p>
{% translate 'First, enter a username and password. Then, youll be able to edit more user options.' %}
</p>
{% else %}
<p>
{% translate "Enter a username and password." %}
</p>
{% endif %}
{% endblock %}

View file

@ -0,0 +1,85 @@
{% extends "admin/base_site.html" %}
{% load i18n static %}
{% load admin_urls %}
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static ">
{% endblock %}
{% block bodyclass %}
{{ block.super }} {{ opts.app_label }}-{{ opts.model_name }} change-form
{% endblock %}
{% if not is_popup %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
&rsaquo;
<a href="{% url 'admin:app_list' app_label=opts.app_label %}">
{{ opts.app_config.verbose_name }}
</a>
&rsaquo;
<a href="{% url opts|admin_urlname:'changelist' %}">
{{ opts.verbose_name_plural|capfirst }}
</a>
&rsaquo;
<a href="{% url opts|admin_urlname:'change' original.pk|admin_urlquote %}">
{{ original|truncatewords:"18" }}
</a>
&rsaquo; {% translate 'Change password' %}
</div>
{% endblock %}
{% endif %}
{% block content %}
<div id="content-main">
<form
{% if form_url %}action="{{ form_url }}" {% endif %}
method="post" id="{{ opts.model_name }}_form">
{% csrf_token %}
{% block form_top %}{% endblock %}
<input type="text" name="username" value="{{ original.get_username }}" class="hidden">
<div>
{% if is_popup %}
<input type="hidden" name="{{ is_popup_var }}" value="1">
{% endif %}
{% if form.errors %}
<p class="errornote">
{% if form.errors.items|length == 1 %}
{% translate "Please correct the error below." %}
{% else %}
{% translate "Please correct the errors below." %}
{% endif %}
</p>
{% endif %}
<p>
{% blocktranslate with username=original %}
Enter a new password for the user
<strong>{{ username }}</strong>
.
{% endblocktranslate %}
</p>
<fieldset class="module aligned">
<div class="form-row">
{{ form.password1.errors }}
{{ form.password1.label_tag }} {{ form.password1 }}
{% if form.password1.help_text %}
<div class="help">
{{ form.password1.help_text|safe }}
</div>
{% endif %}
</div>
<div class="form-row">
{{ form.password2.errors }}
{{ form.password2.label_tag }} {{ form.password2 }}
{% if form.password2.help_text %}
<div class="help">
{{ form.password2.help_text|safe }}
</div>
{% endif %}
</div>
</fieldset>
<div class="submit-row">
<input type="submit" value="{% translate 'Change password' %}" class="default">
</div>
</div>
</form>
</div>
{% endblock %}

View file

@ -0,0 +1,122 @@
{% load i18n static %}
<!DOCTYPE html>
{% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %}
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" dir="{{ LANGUAGE_BIDI|yesno:'rtl,ltr,auto' }}">
<head>
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" type="text/css" href=" {% block stylesheet %} {% static "admin/css/base.css" %}
{% endblock %}
">
{% if not is_popup and is_nav_sidebar_enabled %}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/nav_sidebar.css" %}">
<script src="{% static 'admin/js/nav_sidebar.js' %}" defer></script>
{% endif %}
{% block extrastyle %}{% endblock %}
{% if LANGUAGE_BIDI %}
<link rel="stylesheet" type="text/css" href=" {% block stylesheet_rtl %} {% static "admin/css/rtl.css" %}
{% endblock %}
">
{% endif %}
{% block extrahead %}{% endblock %}
{% block responsive %}
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" type="text/css" href="{% static "admin/css/responsive.css" %}">
{% if LANGUAGE_BIDI %}
<link rel="stylesheet" type="text/css" href="{% static ">
{% endif %}
{% endblock %}
{% block blockbots %}<meta name="robots" content="NONE,NOARCHIVE">{% endblock %}
</head>
<body class="{% if is_popup %}popup {% endif %}{% block bodyclass %}{% endblock %}"
data-admin-utc-offset="{% now ">
<!-- Container -->
<div id="container">
{% if not is_popup %}
<!-- Header -->
{% block header %}
<div id="header">
<div id="branding">
{% block branding %}{% endblock %}
</div>
{% block usertools %}
{% if has_permission %}
<div id="user-tools">
{% block welcome-msg %}
{% translate 'Welcome,' %}
<strong>{% firstof user.get_short_name user.get_username %}</strong>
.
{% endblock %}
{% block userlinks %}
{% if site_url %}
<a href="{{ site_url }}">{% translate 'View site' %}</a>
/
{% endif %}
{% if user.is_active and user.is_staff %}
{% url 'django-admindocs-docroot' as docsroot %}
{% if docsroot %}
<a href="{{ docsroot }}">{% translate 'Documentation' %}</a>
/
{% endif %}
{% endif %}
{% if user.has_usable_password %}
<a href="{% url 'admin:password_change' %}">
{% translate 'Change password' %}
</a>
/
{% endif %}
<a href="{% url 'admin:logout' %}">
{% translate 'Log out' %}
</a>
{% endblock %}
</div>
{% endif %}
{% endblock %}
{% block nav-global %}{% endblock %}</div>{% endblock %}
<!-- END Header -->
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
{% if title %}&rsaquo; {{ title }}{% endif %}
</div>
{% endblock %}{% endif %}
<div class="main" id="main">
{% if not is_popup and is_nav_sidebar_enabled %}
{% block nav-sidebar %}
{% include "admin/nav_sidebar.html" %}{% endblock %}{% endif %}
<div class="content">
{% block messages %}
{% if messages %}
<ul class="messagelist">
{% for message in messages %}
<li{% if message.tags %}class="{{ message.tags }}"{% endif %}>{{ message|capfirst }}
</li>
{% endfor %}
</ul>
{% endif %}
{% endblock messages %}
<!-- Content -->
<div id="content" class="{% block coltype %}colM{% endblock %}">
{% block pretitle %}{% endblock %}
{% block content_title %}{% if title %}
<h1>{{ title }}</h1>
{% endif %}{% endblock %}
{% block content_subtitle %}{% if subtitle %}
<h2>{{ subtitle }}</h2>
{% endif %}{% endblock %}
{% block content %}
{% block object-tools %}{% endblock %}
{{ content }}
{% endblock %}
{% block sidebar %}{% endblock %}
<br class="clear">
</div>
<!-- END Content -->
{% block footer %}
<div id="footer"></div>
{% endblock %}
</div>
</div>
</div>
<!-- END Container -->
</body>
</html>

View file

@ -0,0 +1,13 @@
{% extends "admin/base.html" %}
{% block title %}
{% if subtitle %}{{ subtitle }} |{% endif %}
{{ title }} | {{ site_title|default:_('Django site admin') }}
{% endblock %}
{% block branding %}
<h1 id="site-name">
<a href="{% url 'admin:index' %}">
{{ site_header|default:_('Django administration') }}
</a>
</h1>
{% endblock %}
{% block nav-global %}{% endblock %}

View file

@ -0,0 +1,97 @@
{% extends "admin/base_site.html" %}
{% load i18n admin_urls static admin_modify %}
{% block extrahead %}
{{ block.super }}
<script src="{% url 'admin:jsi18n' %}"></script>
{{ media }}
{% endblock %}
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}">
{% endblock %}
{% block coltype %}colM{% endblock %}
{% block bodyclass %}
{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-form
{% endblock %}
{% if not is_popup %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
&rsaquo;
<a href="{% url 'admin:app_list' app_label=opts.app_label %}">
{{ opts.app_config.verbose_name }}
</a>
&rsaquo;
{% if has_view_permission %}
<a href="{% url opts|admin_urlname:'changelist' %}">
{{ opts.verbose_name_plural|capfirst }}
</a>
{% else %}
{{ opts.verbose_name_plural|capfirst }}
{% endif %}
&rsaquo;
{% if add %}
{% blocktranslate with name=opts.verbose_name %}
Add {{ name }}
{% endblocktranslate %}
{% else %}
{{ original|truncatewords:"18" }}
{% endif %}
</div>
{% endblock %}{% endif %}
{% block content %}
<div id="content-main">
{% block object-tools %}
{% if change %}
{% if not is_popup %}
<ul class="object-tools">
{% block object-tools-items %}
{% change_form_object_tools %}
{% endblock %}
</ul>
{% endif %}
{% endif %}
{% endblock %}
<form {% if has_file_field %}enctype="multipart/form-data"
{% endif %} {% if form_url %}action="{{ form_url }}"
{% endif %} method="post"
id="{{ opts.model_name }}_form">
{% csrf_token %}{% block form_top %}{% endblock %}
<div>
{% if is_popup %}
<input type="hidden" name="{{ is_popup_var }}" value="1">
{% endif %}
{% if to_field %}
<input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}">
{% endif %}
{% if save_on_top %}
{% block submit_buttons_top %}
{% submit_row %}{% endblock %}{% endif %}
{% if errors %}
<p class="errornote">
{% if errors|length == 1 %}{% translate "Please correct the error below." %}{% else %}
{% translate "Please correct the errors below." %}{% endif %}
</p>
{{ adminform.form.non_field_errors }}
{% endif %}
{% block field_sets %}
{% for fieldset in adminform %}
{% include "admin/includes/fieldset.html" %}{% endfor %}
{% endblock %}
{% block after_field_sets %}{% endblock %}
{% block inline_field_sets %}
{% for inline_admin_formset in inline_admin_formsets %}
{% include inline_admin_formset.opts.template %}{% endfor %}
{% endblock %}
{% block after_related_objects %}{% endblock %}
{% block submit_buttons_bottom %}
{% submit_row %}{% endblock %}
{% block admin_change_form_document_ready %}
<script id="django-admin-form-add-constants" src="{% static 'admin/js/change_form.js' %}" {% if adminform and add %}data-model-name="{{ opts.model_name }}" {% endif %} async></script>
{% endblock %}
{# JavaScript for prepopulated fields #}
{% prepopulated_fields_js %}
</div>
</form>
</div>
{% endblock %}

View file

@ -0,0 +1,16 @@
{% load i18n admin_urls %}
{% block object-tools-items %}
<li>
{% url opts|admin_urlname:'history' original.pk|admin_urlquote as history_url %}
<a href="{% add_preserved_filters history_url %}" class="historylink">
{% translate "History" %}
</a>
</li>
{% if has_absolute_url %}
<li>
<a href="{{ absolute_url }}" class="viewsitelink">
{% translate "View on site" %}
</a>
</li>
{% endif %}
{% endblock %}

View file

@ -0,0 +1,113 @@
{% extends "admin/base_site.html" %}
{% load i18n admin_urls static admin_list %}
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/changelists.css" %}">
{% if cl.formset %}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}">
{% endif %}
{% if cl.formset or action_form %}
<script src="{% url 'admin:jsi18n' %}"></script>
{% endif %}
{{ media.css }}
{% if not actions_on_top and not actions_on_bottom %}
<style>
#changelist table thead th:first-child {width: inherit}
</style>
{% endif %}
{% endblock %}
{% block extrahead %}
{{ block.super }}
{{ media.js }}
{% endblock %}
{% block bodyclass %}
{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-list
{% endblock %}
{% if not is_popup %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
&rsaquo;
<a href="{% url 'admin:app_list' app_label=cl.opts.app_label %}">
{{ cl.opts.app_config.verbose_name }}
</a>
&rsaquo; {{ cl.opts.verbose_name_plural|capfirst }}
</div>
{% endblock %}
{% endif %}
{% block coltype %}{% endblock %}
{% block content %}
<div id="content-main">
{% block object-tools %}
<ul class="object-tools">
{% block object-tools-items %}
{% change_list_object_tools %}
{% endblock %}
</ul>
{% endblock %}
{% if cl.formset and cl.formset.errors %}
<p class="errornote">
{% if cl.formset.total_error_count == 1 %}
{% translate "Please correct the error below." %}
{% else %}
{% translate "Please correct the errors below." %}
{% endif %}
</p>
{{ cl.formset.non_form_errors }}
{% endif %}
<div class="module{% if cl.has_filters %}filtered{% endif %}" id="changelist">
<div class="changelist-form-container">
{% block search %}
{% search_form cl %}
{% endblock %}
{% block date_hierarchy %}
{% if cl.date_hierarchy %}
{% date_hierarchy cl %}
{% endif %}
{% endblock %}
<form id="changelist-form" method="post"
{% if cl.formset and cl.formset.is_multipart %}
enctype="multipart/form-data"
{% endif %}
novalidate>
{% csrf_token %}
{% if cl.formset %}
<div>
{{ cl.formset.management_form }}
</div>
{% endif %}
{% block result_list %}
{% if action_form and actions_on_top and cl.show_admin_actions %}
{% admin_actions %}
{% endif %}
{% result_list cl %}
{% if action_form and actions_on_bottom and cl.show_admin_actions %}
{% admin_actions %}
{% endif %}
{% endblock %}
{% block pagination %}
{% pagination cl %}
{% endblock %}
</form>
</div>
{% block filters %}
{% if cl.has_filters %}
<div id="changelist-filter">
<h2>{% translate 'Filter' %}</h2>
{% if cl.has_active_filters %}
<h3 id="changelist-filter-clear">
<a href="{{ cl.clear_all_filters_qs }}">
&#10006; {% translate "Clear all filters" %}
</a>
</h3>
{% endif %}
{% for spec in cl.filter_specs %}
{% admin_list_filter cl spec %}
{% endfor %}
</div>
{% endif %}
{% endblock %}
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,13 @@
{% load i18n admin_urls %}
{% block object-tools-items %}
{% if has_add_permission %}
<li>
{% url cl.opts|admin_urlname:'add' as add_url %}
<a href="{% add_preserved_filters add_url is_popup to_field %}" class="addlink">
{% blocktranslate with cl.opts.verbose_name as name %}
Add {{ name }}
{% endblocktranslate %}
</a>
</li>
{% endif %}
{% endblock %}

View file

@ -0,0 +1,59 @@
{% load i18n %}
{% if result_hidden_fields %}
<div class="hiddenfields">
{# DIV for HTML validation #}
{% for item in result_hidden_fields %}{{ item }}{% endfor %}
</div>
{% endif %}
{% if results %}
<div class="results">
<table id="result_list">
<thead>
<tr>
{% for header in result_headers %}
<th scope="col"{{ header.class_attrib }}>
{% if header.sortable %}
{% if header.sort_priority > 0 %}
<div class="sortoptions">
<a class="sortremove" href="{{ header.url_remove }}" title="{% translate "></a>
{% if num_sorted_fields > 1 %}
<span class="sortpriority"
title="{% blocktranslate with priority_number=header.sort_priority %}Sorting priority: {{ priority_number }}{% endblocktranslate %}">
{{ header.sort_priority }}
</span>
{% endif %}
<a href="{{ header.url_toggle }}"
class="toggle {% if header.ascending %}ascending{% else %}descending{% endif %}"
title="{% translate "></a>
</div>
{% endif %}
{% endif %}
<div class="text">
{% if header.sortable %}
<a href="{{ header.url_primary }}">
{{ header.text|capfirst }}
</a>
{% else %}
<span>{{ header.text|capfirst }}</span>
{% endif %}
</div>
<div class="clear"></div>
</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for result in results %}
{% if result.form and result.form.non_field_errors %}
<tr>
<td colspan="{{ result|length }}">{{ result.form.non_field_errors }}</td>
</tr>
{% endif %}
<tr>
{% for item in result %}{{ item }}{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}

View file

@ -0,0 +1,25 @@
{% if show %}
<div class="xfull">
<ul class="toplinks">
{% block date-hierarchy-toplinks %}
{% block date-hierarchy-back %}
{% if back %}
<li class="date-back">
<a href="{{ back.link }}">&lsaquo; {{ back.title }}</a>
</li>
{% endif %}
{% endblock %}
{% block date-hierarchy-choices %}
{% for choice in choices %}
<li>
{% if choice.link %}<a href="{{ choice.link }}">{% endif %}
{{ choice.title }}
{% if choice.link %}</a>{% endif %}
</li>
{% endfor %}
{% endblock %}
{% endblock %}
</ul>
<br class="clear">
</div>
{% endif %}

View file

@ -0,0 +1,84 @@
{% extends "admin/base_site.html" %}
{% load i18n admin_urls static %}
{% block extrahead %}
{{ block.super }}
{{ media }}
<script src="{% static 'admin/js/cancel.js' %}" async></script>
{% endblock %}
{% block bodyclass %}
{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation
{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
&rsaquo;
<a href="{% url 'admin:app_list' app_label=opts.app_label %}">
{{ opts.app_config.verbose_name }}
</a>
&rsaquo;
<a href="{% url opts|admin_urlname:'changelist' %}">
{{ opts.verbose_name_plural|capfirst }}
</a>
&rsaquo;
<a href="{% url opts|admin_urlname:'change' object.pk|admin_urlquote %}">
{{ object|truncatewords:"18" }}
</a>
&rsaquo; {% translate 'Delete' %}
</div>
{% endblock %}
{% block content %}
{% if perms_lacking %}
<p>
{% blocktranslate with escaped_object=object %}
Deleting the {{ object_name }} '{{ escaped_object }}' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:
{% endblocktranslate %}
</p>
<ul>
{% for obj in perms_lacking %}
<li>
{{ obj }}
</li>
{% endfor %}
</ul>
{% elif protected %}
<p>
{% blocktranslate with escaped_object=object %}
Deleting the {{ object_name }} '{{ escaped_object }}' would require deleting the following protected related objects:
{% endblocktranslate %}
</p>
<ul>
{% for obj in protected %}
<li>
{{ obj }}
</li>
{% endfor %}
</ul>
{% else %}
<p>
{% blocktranslate with escaped_object=object %}
Are you sure you want to delete the {{ object_name }} "{{ escaped_object }}"? All of the following related items will be deleted:
{% endblocktranslate %}
</p>
{% include "admin/includes/object_delete_summary.html" %}
<h2>{% translate "Objects" %}</h2>
<ul>
{{ deleted_objects|unordered_list }}
</ul>
<form method="post">
{% csrf_token %}
<div>
<input type="hidden" name="post" value="yes">
{% if is_popup %}
<input type="hidden" name="{{ is_popup_var }}" value="1">
{% endif %}
{% if to_field %}
<input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}">
{% endif %}
<input type="submit" value="{% translate 'Yes, Im sure' %}">
<a href="#" class="button cancel-link">
{% translate "No, take me back" %}
</a>
</div>
</form>
{% endif %}
{% endblock %}

View file

@ -0,0 +1,80 @@
{% extends "admin/base_site.html" %}
{% load i18n l10n admin_urls static %}
{% block extrahead %}
{{ block.super }}
{{ media }}
<script src="{% static 'admin/js/cancel.js' %}" async></script>
{% endblock %}
{% block bodyclass %}
{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation delete-selected-confirmation
{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
&rsaquo;
<a href="{% url 'admin:app_list' app_label=opts.app_label %}">
{{ opts.app_config.verbose_name }}
</a>
&rsaquo;
<a href="{% url opts|admin_urlname:'changelist' %}">
{{ opts.verbose_name_plural|capfirst }}
</a>
&rsaquo; {% translate 'Delete multiple objects' %}
</div>
{% endblock %}
{% block content %}
{% if perms_lacking %}
<p>
{% blocktranslate %}
Deleting the selected {{ objects_name }} would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:
{% endblocktranslate %}
</p>
<ul>
{% for obj in perms_lacking %}
<li>
{{ obj }}
</li>
{% endfor %}
</ul>
{% elif protected %}
<p>
{% blocktranslate %}
Deleting the selected {{ objects_name }} would require deleting the following protected related objects:
{% endblocktranslate %}
</p>
<ul>
{% for obj in protected %}
<li>
{{ obj }}
</li>
{% endfor %}
</ul>
{% else %}
<p>
{% blocktranslate %}
Are you sure you want to delete the selected {{ objects_name }}? All of the following objects and their related items will be deleted:
{% endblocktranslate %}
</p>
{% include "admin/includes/object_delete_summary.html" %}
<h2>{% translate "Objects" %}</h2>
{% for deletable_object in deletable_objects %}
<ul>
{{ deletable_object|unordered_list }}
</ul>
{% endfor %}
<form method="post">
{% csrf_token %}
<div>
{% for obj in queryset %}
<input type="hidden" name="{{ action_checkbox_name }}" value="{{ obj.pk|unlocalize }}">
{% endfor %}
<input type="hidden" name="action" value="delete_selected">
<input type="hidden" name="post" value="yes">
<input type="submit" value="{% translate 'Yes, Im sure' %}">
<a href="#" class="button cancel-link">
{% translate "No, take me back" %}
</a>
</div>
</form>
{% endif %}
{% endblock %}

View file

@ -0,0 +1,53 @@
{% load i18n admin_urls %}
<div class="js-inline-admin-formset inline-group"
id="{{ inline_admin_formset.formset.prefix }}-group"
data-inline-type="stacked"
data-inline-formset="{{ inline_admin_formset.inline_formset_data }}">
<fieldset class="module {{ inline_admin_formset.classes }}">
{% if inline_admin_formset.formset.max_num == 1 %}
<h2>{{ inline_admin_formset.opts.verbose_name|capfirst }}</h2>
{% else %}
<h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2>
{% endif %}
{{ inline_admin_formset.formset.management_form }}
{{ inline_admin_formset.formset.non_form_errors }}
{% for inline_admin_form in inline_admin_formset %}
<div class="inline-related{% if inline_admin_form.original or inline_admin_form.show_url %} has_original{% endif %}{% if forloop.last and inline_admin_formset.has_add_permission %} empty-form last-related{% endif %}"
id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
<h3>
<b>
{{ inline_admin_formset.opts.verbose_name|capfirst }}:
</b>
<span class="inline_label">
{% if inline_admin_form.original %}
{{ inline_admin_form.original }}
{% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %}
<a href="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}"
class="{% if inline_admin_formset.has_change_permission %}inlinechangelink{% else %}inlineviewlink{% endif %}">
{% if inline_admin_formset.has_change_permission %}{% translate "Change" %}{% else %}{% translate "View" %}{% endif %}
</a>
{% endif %}
{% else %}
#{{ forloop.counter }}
{% endif %}
</span>
{% if inline_admin_form.show_url %}
<a href="{{ inline_admin_form.absolute_url }}">
{% translate "View on site" %}
</a>
{% endif %}
{% if inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission and inline_admin_form.original %}
<span class="delete">
{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}
</span>
{% endif %}
</h3>
{% if inline_admin_form.form.non_field_errors %}{{ inline_admin_form.form.non_field_errors }}{% endif %}
{% for fieldset in inline_admin_form %}
{% include "admin/includes/fieldset.html" %}{% endfor %}
{% if inline_admin_form.needs_explicit_pk_field %}{{ inline_admin_form.pk_field.field }}{% endif %}
{% if inline_admin_form.fk_field %}{{ inline_admin_form.fk_field.field }}{% endif %}
</div>
{% endfor %}
</fieldset>
</div>

View file

@ -0,0 +1,110 @@
{% load i18n admin_urls static admin_modify %}
<div class="js-inline-admin-formset inline-group"
id="{{ inline_admin_formset.formset.prefix }}-group"
data-inline-type="tabular"
data-inline-formset="{{ inline_admin_formset.inline_formset_data }}">
<div class="tabular inline-related {% if forloop.last %}last-related{% endif %}">
{{ inline_admin_formset.formset.management_form }}
<fieldset class="module {{ inline_admin_formset.classes }}">
{% if inline_admin_formset.formset.max_num == 1 %}
<h2>{{ inline_admin_formset.opts.verbose_name|capfirst }}</h2>
{% else %}
<h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2>
{% endif %}
{{ inline_admin_formset.formset.non_form_errors }}
<table>
<thead>
<tr>
<th class="original"></th>
{% for field in inline_admin_formset.fields %}
{% if not field.widget.is_hidden %}
<th class="column-{{ field.name }}{% if field.required %}required{% endif %}">
{{ field.label|capfirst }}
{% if field.help_text %}
<img src="{% static "
admin/img/icon-unknown.svg" %}" class="help help-tooltip"
width="10"
height="10"
alt="({{ field.help_text|striptags }})"
title="{{ field.help_text|striptags }}">
{% endif %}
</th>
{% endif %}
{% endfor %}
{% if inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission %}
<th>{% translate "Delete?" %}</th>
{% endif %}
</tr>
</thead>
<tbody>
{% for inline_admin_form in inline_admin_formset %}
{% if inline_admin_form.form.non_field_errors %}
<tr class="row-form-errors">
<td colspan="{{ inline_admin_form|cell_count }}">
{{ inline_admin_form.form.non_field_errors }}
</td>
</tr>
{% endif %}
<tr class="form-row {% if inline_admin_form.original or inline_admin_form.show_url %}has_original{% endif %}{% if forloop.last and inline_admin_formset.has_add_permission %} empty-form{% endif %}"
id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
<td class="original">
{% if inline_admin_form.original or inline_admin_form.show_url %}
<p>
{% if inline_admin_form.original %}
{{ inline_admin_form.original }}
{% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %}
<a href="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}"
class="{% if inline_admin_formset.has_change_permission %}inlinechangelink{% else %}inlineviewlink{% endif %}">
{% if inline_admin_formset.has_change_permission %}{% translate "Change" %}{% else %}{% translate "View" %}{% endif %}
</a>
{% endif %}
{% endif %}
{% if inline_admin_form.show_url %}
<a href="{{ inline_admin_form.absolute_url }}">
{% translate "View on site" %}
</a>
{% endif %}
</p>
{% endif %}
{% if inline_admin_form.needs_explicit_pk_field %}{{ inline_admin_form.pk_field.field }}{% endif %}
{% if inline_admin_form.fk_field %}{{ inline_admin_form.fk_field.field }}{% endif %}
{% spaceless %}
{% for fieldset in inline_admin_form %}
{% for line in fieldset %}
{% for field in line %}
{% if not field.is_readonly and field.field.is_hidden %}{{ field.field }}{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endspaceless %}
</td>
{% for fieldset in inline_admin_form %}
{% for line in fieldset %}
{% for field in line %}
{% if field.is_readonly or not field.field.is_hidden %}
<td{% if field.field.name %}class="field-{{ field.field.name }}"{% endif %}>
{% if field.is_readonly %}
<p>
{{ field.contents }}
</p>
{% else %}
{{ field.field.errors.as_ul }}
{{ field.field }}
{% endif %}
</td>
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
{% if inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission %}
<td class="delete">
{% if inline_admin_form.original %}{{ inline_admin_form.deletion_field.field }}{% endif %}
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</fieldset>
</div>
</div>

View file

@ -0,0 +1,17 @@
{% load i18n %}
<h3>
{% blocktranslate with filter_title=title %}
By {{ filter_title }}
{% endblocktranslate %}
</h3>
<ul>
{% for choice in choices %}
<li
{% if choice.selected %}class="selected" {% endif %}
>
<a href="{{ choice.query_string|iriencode }}" title="{{ choice.display }}">
{{ choice.display }}
</a>
</li>
{% endfor %}
</ul>

View file

@ -0,0 +1,37 @@
<fieldset class="module aligned {{ fieldset.classes }}">
{% if fieldset.name %}<h2>{{ fieldset.name }}</h2>{% endif %}
{% if fieldset.description %}
<div class="description">
{{ fieldset.description|safe }}
</div>
{% endif %}
{% for line in fieldset %}
<div class="form-row{% if line.fields|length_is:'1' and line.errors %} errors{% endif %}{% if not line.has_visible_field %}hidden{% endif %}{% for field in line %}{% if field.field.name %}field-{{ field.field.name }}{% endif %}{% endfor %}">
{% if line.fields|length_is:'1' %}{{ line.errors }}{% endif %}
{% for field in line %}
<div
{% if not line.fields|length_is:'1' %}
class="fieldBox {% if field.field.name %}field-{{ field.field.name }}{% endif %}{% if not field.is_readonly and field.errors %} errors{% endif %}{% if field.field.is_hidden %}hidden{% endif %}"{% elif field.is_checkbox %} class="checkbox-row"{% endif %}>
{% if not line.fields|length_is:'1' and not field.is_readonly %}{{ field.errors }}{% endif %}
{% if field.is_checkbox %}
{{ field.field }}{{ field.label_tag }}
{% else %}
{{ field.label_tag }}
{% if field.is_readonly %}
<div class="readonly">
{{ field.contents }}
</div>
{% else %}
{{ field.field }}
{% endif %}
{% endif %}
{% if field.field.help_text %}
<div class="help">
{{ field.field.help_text|safe }}
</div>
{% endif %}
</div>
{% endfor %}
</div>
{% endfor %}
</fieldset>

View file

@ -0,0 +1,9 @@
{% load i18n %}
<h2>{% translate "Summary" %}</h2>
<ul>
{% for model_name, object_count in model_count %}
<li>
{{ model_name|capfirst }}: {{ object_count }}
</li>
{% endfor %}
</ul>

View file

@ -0,0 +1,53 @@
{% extends "admin/base_site.html" %}
{% load i18n static %}
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/dashboard.css" %}">
{% endblock %}
{% block coltype %}colMS{% endblock %}
{% block bodyclass %}{{ block.super }} dashboard{% endblock %}
{% block breadcrumbs %}{% endblock %}
{% block nav-sidebar %}{% endblock %}
{% block content %}
<div id="content-main">
{% include "admin/app_list.html" with app_list=app_list show_changelinks=True %}
</div>
{% endblock %}
{% block sidebar %}
<div id="content-related">
<div class="module" id="recent-actions-module">
<h2>{% translate 'Recent actions' %}</h2>
<h3>{% translate 'My actions' %}</h3>
{% load log %}
{% get_admin_log 10 as admin_log for_user user %}
{% if not admin_log %}
<p>
{% translate 'None available' %}
</p>
{% else %}
<ul class="actionlist">
{% for entry in admin_log %}
<li class="{% if entry.is_addition %}addlink{% endif %}{% if entry.is_change %}changelink{% endif %}{% if entry.is_deletion %}deletelink{% endif %}">
{% if entry.is_deletion or not entry.get_admin_url %}
{{ entry.object_repr }}
{% else %}
<a href="{{ entry.get_admin_url }}">
{{ entry.object_repr }}
</a>
{% endif %}
<br>
{% if entry.content_type %}
<span class="mini quiet">
{% filter capfirst %}{{ entry.content_type.name }}
{% endfilter %}
</span>
{% else %}
<span class="mini quiet">{% translate 'Unknown content' %}</span>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,13 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
&rsaquo; {{ title }}
</div>
{% endblock %}
{% block content %}
<p>
{% translate 'Somethings wrong with your database installation. Make sure the appropriate database tables have been created, and make sure the database is readable by the appropriate user.' %}
</p>
{% endblock %}

View file

@ -0,0 +1,64 @@
{% extends "admin/base_site.html" %}
{% load i18n static %}
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/login.css" %}">
{{ form.media }}
{% endblock %}
{% block bodyclass %}{{ block.super }} login{% endblock %}
{% block usertools %}{% endblock %}
{% block nav-global %}{% endblock %}
{% block nav-sidebar %}{% endblock %}
{% block content_title %}{% endblock %}
{% block breadcrumbs %}{% endblock %}
{% block content %}
{% if form.errors and not form.non_field_errors %}
<p class="errornote">
{% if form.errors.items|length == 1 %}
{% translate "Please correct the error below." %}
{% else %}
{% translate "Please correct the errors below." %}
{% endif %}
</p>
{% endif %}
{% if form.non_field_errors %}
{% for error in form.non_field_errors %}
<p class="errornote">
{{ error }}
</p>
{% endfor %}
{% endif %}
<div id="content-main">
{% if user.is_authenticated %}
<p class="errornote">
{% blocktranslate trimmed %}
You are authenticated as {{ username }}, but are not authorized to
access this page. Would you like to login to a different account?
{% endblocktranslate %}
</p>
{% endif %}
<form action="{{ app_path }}" method="post" id="login-form">
{% csrf_token %}
<div class="form-row">
{{ form.username.errors }}
{{ form.username.label_tag }} {{ form.username }}
</div>
<div class="form-row">
{{ form.password.errors }}
{{ form.password.label_tag }} {{ form.password }}
<input type="hidden" name="next" value="{{ next }}">
</div>
{% url 'admin_password_reset' as password_reset_url %}
{% if password_reset_url %}
<div class="password-reset-link">
<a href="{{ password_reset_url }}">
{% translate 'Forgotten your password or username?' %}
</a>
</div>
{% endif %}
<div class="submit-row">
<input type="submit" value="{% translate 'Log in' %}">
</div>
</form>
</div>
{% endblock %}

View file

@ -0,0 +1,11 @@
{% load i18n %}
<button class="sticky toggle-nav-sidebar"
id="toggle-nav-sidebar"
aria-label="{% translate 'Toggle navigation' %}"></button>
<nav class="sticky" id="nav-sidebar">
<input type="search"
id="nav-filter"
placeholder="{% translate 'Start typing to filter...' %}"
aria-label="{% translate 'Filter navigation items' %}">
{% include 'admin/app_list.html' with app_list=available_apps show_changelinks=False %}
</nav>

View file

@ -0,0 +1,53 @@
{% extends "admin/base_site.html" %}
{% load i18n admin_urls %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
&rsaquo;
<a href="{% url 'admin:app_list' app_label=opts.app_label %}">
{{ opts.app_config.verbose_name }}
</a>
&rsaquo;
<a href="{% url opts|admin_urlname:'changelist' %}">
{{ module_name }}
</a>
&rsaquo;
<a href="{% url opts|admin_urlname:'change' object.pk|admin_urlquote %}">
{{ object|truncatewords:"18" }}
</a>
&rsaquo; {% translate 'History' %}
</div>
{% endblock %}
{% block content %}
<div id="content-main">
<div class="module">
{% if action_list %}
<table id="change-history">
<thead>
<tr>
<th scope="col">{% translate 'Date/time' %}</th>
<th scope="col">{% translate 'User' %}</th>
<th scope="col">{% translate 'Action' %}</th>
</tr>
</thead>
<tbody>
{% for action in action_list %}
<tr>
<th scope="row">{{ action.action_time|date:"DATETIME_FORMAT" }}</th>
<td>
{{ action.user.get_username }}
{% if action.user.get_full_name %}({{ action.user.get_full_name }}){% endif %}
</td>
<td>{{ action.get_change_message }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>
{% translate 'This object doesnt have a change history. It probably wasnt added via this admin site.' %}
</p>
{% endif %}
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,23 @@
{% load admin_list %}
{% load i18n %}
<p class="paginator">
{% if pagination_required %}
{% for i in page_range %}
{% paginator_number cl i %}
{% endfor %}
{% endif %}
{{ cl.result_count }}
{% if cl.result_count == 1 %}
{{ cl.opts.verbose_name }}
{% else %}
{{ cl.opts.verbose_name_plural }}
{% endif %}
{% if show_all_url %}
<a href="{{ show_all_url }}" class="showall">
{% translate 'Show all' %}
</a>
{% endif %}
{% if cl.formset and cl.result_count %}
<input type="submit" name="_save" class="default" value="{% translate 'Save' %}">
{% endif %}
</p>

View file

@ -0,0 +1,10 @@
{% load i18n static %}
<!DOCTYPE html>
<html>
<head>
<title>{% translate 'Popup closing…' %}</title>
</head>
<body>
<script id="django-admin-popup-response-constants" src="{% static "admin/js/popup_response.js" %}" data-popup-response="{{ popup_response_data }}"></script>
</body>
</html>

View file

@ -0,0 +1,2 @@
{% load static %}
<script id="django-admin-prepopulated-fields-constants" src="{% static "admin/js/prepopulate_init.js" %}" data-prepopulated-fields="{{ prepopulated_fields_json }}"></script>

View file

@ -0,0 +1,44 @@
{% load i18n static %}
{% if cl.search_fields %}
<div id="toolbar">
<form id="changelist-search" method="get">
<div>
<!-- DIV needed for valid HTML -->
<label for="searchbar">
<img src="{% static "admin/img/search.svg" %}" alt="Search">
</label>
<input type="text" size="40" name="{{ search_var }}" value="{{ cl.query }}" id="searchbar">
<input type="submit" value="{% translate 'Search' %}">
{% if show_result_count %}
<span class="small quiet">
{% blocktranslate count counter=cl.result_count %}
{{ counter }} result{% plural %}{{ counter }} results
{% endblocktranslate %}
(
<a href="?{% if cl.is_popup %}{{ is_popup_var }}=1{% endif %}">
{% if cl.show_full_result_count %}
{% blocktranslate with full_result_count=cl.full_result_count %}
{{ full_result_count }} total
{% endblocktranslate %}
{% else %}
{% translate "Show all" %}
{% endif %}
</a>
)
</span>
{% endif %}
{% for pair in cl.params.items %}
{% if pair.0 != search_var %}
<input type="hidden" name="{{ pair.0 }}" value="{{ pair.1 }}">
{% endif %}
{% endfor %}
</div>
{% if cl.search_help_text %}
<br class="clear">
<div class="help">
{{ cl.search_help_text }}
</div>
{% endif %}
</form>
</div>
{% endif %}

View file

@ -0,0 +1,32 @@
{% load i18n admin_urls %}
<div class="submit-row">
{% block submit-row %}
{% if show_save %}
<input type="submit" value="{% translate 'Save' %}" class="default" name="_save">
{% endif %}
{% if show_delete_link and original %}
{% url opts|admin_urlname:'delete' original.pk|admin_urlquote as delete_url %}
<p class="deletelink-box">
<a href="{% add_preserved_filters delete_url %}" class="deletelink">
{% translate "Delete" %}
</a>
</p>
{% endif %}
{% if show_save_as_new %}
<input type="submit" value="{% translate 'Save as new' %}" name="_saveasnew">
{% endif %}
{% if show_save_and_add_another %}
<input type="submit" value="{% translate 'Save and add another' %}" name="_addanother">
{% endif %}
{% if show_save_and_continue %}
<input type="submit"
value="{% if can_change %} {% translate 'Save and continue editing' %}{% else %}{% translate 'Save and view' %}{% endif %}"
name="_continue">
{% endif %}
{% if show_close %}
<a href="{% url opts|admin_urlname:'changelist' %}" class="closelink">
{% translate 'Close' %}
</a>
{% endif %}
{% endblock %}
</div>

View file

@ -0,0 +1,21 @@
{% if widget.is_initial %}
<p class="file-upload">
{{ widget.initial_text }}:
<a href="{{ widget.value.url }}">{{ widget.value }}</a>
{% if not widget.required %}
<span class="clearable-file-input">
<input type="checkbox" name="{{ widget.checkbox_name }}" id="{{ widget.checkbox_id }}"
{% if widget.attrs.disabled %}disabled {% endif %}
>
<label for="{{ widget.checkbox_id }}">
{{ widget.clear_checkbox_label }}
</label>
</span>
{% endif %}
<br>
{{ widget.input_text }}:
{% endif %}
<input type="{{ widget.type }}" name="{{ widget.name }}"
{% include "django/forms/widgets/attrs.html" %}
>
{% if widget.is_initial %}</p>{% endif %}

View file

@ -0,0 +1,11 @@
{% include 'django/forms/widgets/input.html' %}
{% if related_url %}
<a href="{{ related_url }}" class="related-lookup" id="lookup_id_{{ widget.name }}" title="{{ link_title }}"></a>
{% endif %}
{% if link_label %}
<strong>
{% if link_url %}<a href="{{ link_url }}">{% endif %}
{{ link_label }}
{% if link_url %}</a>{% endif %}
</strong>
{% endif %}

View file

@ -0,0 +1 @@
{% include 'admin/widgets/foreign_key_raw_id.html' %}

View file

@ -0,0 +1 @@
{% include "django/forms/widgets/multiple_input.html" %}

View file

@ -0,0 +1,34 @@
{% load i18n static %}
<div class="related-widget-wrapper">
{{ rendered_widget }}
{% block links %}
{% spaceless %}
{% if not is_hidden %}
{% if can_change_related %}
<a class="related-widget-wrapper-link change-related"
id="change_id_{{ name }}"
data-href-template="{{ change_related_template_url }}?{{ url_params }}"
title="{% blocktranslate %}Change selected {{ model }}{% endblocktranslate %}">
<img src="{% static 'admin/img/icon-changelink.svg' %}" alt="{% translate 'Change' %}">
</a>
{% endif %}
{% if can_add_related %}
<a class="related-widget-wrapper-link add-related"
id="add_id_{{ name }}"
href="{{ add_related_url }}?{{ url_params }}"
title="{% blocktranslate %}Add another {{ model }}{% endblocktranslate %}">
<img src="{% static 'admin/img/icon-addlink.svg' %}" alt="{% translate 'Add' %}">
</a>
{% endif %}
{% if can_delete_related %}
<a class="related-widget-wrapper-link delete-related"
id="delete_id_{{ name }}"
data-href-template="{{ delete_related_template_url }}?{{ url_params }}"
title="{% blocktranslate %}Delete selected {{ model }}{% endblocktranslate %}">
<img src="{% static 'admin/img/icon-deletelink.svg' %}" alt="{% translate 'Delete' %}">
</a>
{% endif %}
{% endif %}
{% endspaceless %}
{% endblock %}
</div>

View file

@ -0,0 +1,7 @@
<p class="datetime">
{{ date_label }} {% with widget=widget.subwidgets.0 %}
{% include widget.template_name %}{% endwith %}
<br>
{{ time_label }} {% with widget=widget.subwidgets.1 %}
{% include widget.template_name %}{% endwith %}
</p>

View file

@ -0,0 +1,9 @@
{% if url_valid %}
<p class="url">
{{ current_label }}
<a href="{{ widget.href }}">{{ widget.value }}</a>
<br>
{{ change_label }}
{% endif %}
{% include "django/forms/widgets/input.html" %}
{% if url_valid %}</p>{% endif %}

View file

@ -0,0 +1,16 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
</div>
{% endblock %}
{% block nav-sidebar %}{% endblock %}
{% block content %}
<p>
{% translate "Thanks for spending some quality time with the Web site today." %}
</p>
<p>
<a href="{% url 'admin:index' %}">{% translate 'Log in again' %}</a>
</p>
{% endblock %}

View file

@ -0,0 +1,24 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
{% block userlinks %}
{% url 'django-admindocs-docroot' as docsroot %}
{% if docsroot %}
<a href="{{ docsroot }}">{% translate 'Documentation' %}</a>
/
{% endif %}
{% translate 'Change password' %} /
<a href="{% url 'admin:logout' %}">
{% translate 'Log out' %}
</a>
{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
&rsaquo; {% translate 'Password change' %}
</div>
{% endblock %}
{% block content %}
<p>
{% translate 'Your password was changed.' %}
</p>
{% endblock %}

View file

@ -0,0 +1,71 @@
{% extends "admin/base_site.html" %}
{% load i18n static %}
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}">
{% endblock %}
{% block userlinks %}
{% url 'django-admindocs-docroot' as docsroot %}
{% if docsroot %}
<a href="{{ docsroot }}">{% translate 'Documentation' %}</a>
/
{% endif %}
{% translate 'Change password' %} /
<a href="{% url 'admin:logout' %}">
{% translate 'Log out' %}
</a>
{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
&rsaquo; {% translate 'Password change' %}
</div>
{% endblock %}
{% block content %}
<div id="content-main">
<form method="post">
{% csrf_token %}
<div>
{% if form.errors %}
<p class="errornote">
{% if form.errors.items|length == 1 %}
{% translate "Please correct the error below." %}
{% else %}
{% translate "Please correct the errors below." %}
{% endif %}
</p>
{% endif %}
<p>
{% translate 'Please enter your old password, for securitys sake, and then enter your new password twice so we can verify you typed it in correctly.' %}
</p>
<fieldset class="module aligned wide">
<div class="form-row">
{{ form.old_password.errors }}
{{ form.old_password.label_tag }} {{ form.old_password }}
</div>
<div class="form-row">
{{ form.new_password1.errors }}
{{ form.new_password1.label_tag }} {{ form.new_password1 }}
{% if form.new_password1.help_text %}
<div class="help">
{{ form.new_password1.help_text|safe }}
</div>
{% endif %}
</div>
<div class="form-row">
{{ form.new_password2.errors }}
{{ form.new_password2.label_tag }} {{ form.new_password2 }}
{% if form.new_password2.help_text %}
<div class="help">
{{ form.new_password2.help_text|safe }}
</div>
{% endif %}
</div>
</fieldset>
<div class="submit-row">
<input type="submit" value="{% translate 'Change my password' %}" class="default">
</div>
</div>
</form>
</div>
{% endblock %}

View file

@ -0,0 +1,16 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
&rsaquo; {% translate 'Password reset' %}
</div>
{% endblock %}
{% block content %}
<p>
{% translate "Your password has been set. You may go ahead and log in now." %}
</p>
<p>
<a href="{{ login_url }}">{% translate 'Log in' %}</a>
</p>
{% endblock %}

View file

@ -0,0 +1,44 @@
{% extends "admin/base_site.html" %}
{% load i18n static %}
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}">
{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
&rsaquo; {% translate 'Password reset confirmation' %}
</div>
{% endblock %}
{% block content %}
{% if validlink %}
<p>
{% translate "Please enter your new password twice so we can verify you typed it in correctly." %}
</p>
<form method="post">
{% csrf_token %}
<fieldset class="module aligned">
<input class="hidden" autocomplete="username" value="{{ form.user.get_username }}">
<div class="form-row field-password1">
{{ form.new_password1.errors }}
<label for="id_new_password1">
{% translate 'New password:' %}
</label>
{{ form.new_password1 }}
</div>
<div class="form-row field-password2">
{{ form.new_password2.errors }}
<label for="id_new_password2">
{% translate 'Confirm password:' %}
</label>
{{ form.new_password2 }}
</div>
<input type="submit" value="{% translate 'Change my password' %}">
</fieldset>
</form>
{% else %}
<p>
{% translate "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}
</p>
{% endif %}
{% endblock %}

View file

@ -0,0 +1,16 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
&rsaquo; {% translate 'Password reset' %}
</div>
{% endblock %}
{% block content %}
<p>
{% translate 'Weve emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly.' %}
</p>
<p>
{% translate 'If you dont receive an email, please make sure youve entered the address you registered with, and check your spam folder.' %}
</p>
{% endblock %}

View file

@ -0,0 +1,15 @@
{% load i18n %}
{% autoescape off %}
{% blocktranslate %}
You're receiving this email because you requested a password reset for your user account at {{ site_name }}.
{% endblocktranslate %}
{% translate "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
{% endblock %}
{% translate 'Your username, in case youve forgotten:' %} {{ user.get_username }}
{% translate "Thanks for using our site!" %}
{% blocktranslate %}
The {{ site_name }} team
{% endblocktranslate %}
{% endautoescape %}

View file

@ -0,0 +1,30 @@
{% extends "admin/base_site.html" %}
{% load i18n static %}
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}">
{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
&rsaquo; {% translate 'Password reset' %}
</div>
{% endblock %}
{% block content %}
<p>
{% translate 'Forgotten your password? Enter your email address below, and well email instructions for setting a new one.' %}
</p>
<form method="post">
{% csrf_token %}
<fieldset class="module aligned">
<div class="form-row field-email">
{{ form.email.errors }}
<label for="id_email">
{% translate 'Email address:' %}
</label>
{{ form.email }}
</div>
<input type="submit" value="{% translate 'Reset my password' %}">
</fieldset>
</form>
{% endblock %}

View file

@ -0,0 +1,17 @@
{% extends "admin/change_form.html" %}
{% load i18n admin_urls %}
{% block submit_buttons_bottom %}
<div class="submit-row"
{% if is_popup %}style="overflow: auto;" {% endif %}
>
<input type="submit" name="_save" class="default" value="{% trans 'Save' %}"/>
{% if not add %}
<p class="deletelink-box">
{% url opts|admin_urlname:'delete' original.pk|admin_urlquote as delete_url %}
<a href="{% add_preserved_filters delete_url %}" class="deletelink">
{% trans "Delete" %}
</a>
</p>
{% endif %}
</div>
{% endblock %}

View file

@ -0,0 +1,73 @@
{% load i18n %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head height="100%">
<title>{{ title }}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en-us" />
<style type="text/css">
html,
body,
.grid {
height: 100%;
}
.header {
margin-bottom: 40px;
}
.content {
padding: 28px;
font-family: Lucida Grande;
font-size: 12px;
}
.content h1 {
font-size: 20px;
font-weight: normal;
}
.content a,
.content a:active,
.content a:visited,
.content a:hover {
text-decoration: underline;
}
.data {
line-height: 24px;
}
</style>
</head>
<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" height="100%">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" class="grid">
<tr>
<td width="100%" class="content" valign="top">
<div class="header">
<h1>{{ title }}</h1>
{% block header %}{% endblock %}
</div>
{% block content %}{% endblock %}
</td>
</tr>
<tr>
<td class="content">
<p>
{% blocktrans %}
Log in to administration
<a href="{{ login_url }}">here</a>
.
{% endblocktrans %}
</p>
<p>
Generated by
<a href="https://www.django-cms.org">
django cms
</a>
{% now "d.m.Y H:i:s" %}.
</p>
</td>
</tr>
</table>
</body>
</html>

View file

@ -0,0 +1,10 @@
{% load i18n %}
{{ title }}
--------------
{% block header %}{% endblock %}
{% block content %}{% endblock %}
{% blocktrans %}Login url: {{ login_url }}{% endblocktrans %}
[Generated by: http://www.django-cms.org {% now "d.m.Y H:i:s" %}.]

View file

@ -0,0 +1,14 @@
{% extends 'admin/cms/mail/base.html' %}
{% load i18n %}
{% block content %}
<table>
<tr>
<td>{% trans 'Username:' %}</td>
<td>{{ user.username }}</td>
</tr>
<tr>
<td>{% trans 'Password:' %}</td>
<td>{{ password }}</td>
</tr>
</table>
{% endblock %}

View file

@ -0,0 +1,7 @@
{% extends 'admin/cms/mail/base.txt' %}
{% load i18n %}
{% block content %}
{% trans 'Username:' %} {{ user.username }}
{% trans 'Password:' %} {{ password }}
{% endblock %}

View file

@ -0,0 +1,130 @@
{% extends "admin/change_form.html" %}
{% load i18n admin_urls static admin_modify admin_urls cms_admin cms_static %}
{% block title %}
{% if add %}
{% trans 'Add a page' %}
{% else %}
{% trans "Change a page" %}
{% endif %}
{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
&rsaquo;
<a href="{% url 'admin:app_list' app_label=opts.app_label %}">
{{ opts.app_config.verbose_name }}
</a>
&rsaquo;
{% if has_change_permission %}
<a href="{% url opts|admin_urlname:'changelist' %}">
{{ opts.verbose_name_plural|capfirst }}
</a>
{% else %}
{{ opts.verbose_name_plural|capfirst }}
{% endif %}
&rsaquo;
{% if add %}
{% trans 'Add' %} {{ opts.verbose_name }}
{% else %}
{{ original|truncatewords:"18" }}
{% endif %}
</div>
{% endblock %}
{% block extrahead %}
<script src="{% static "admin/js/urlify.js" %}" type="text/javascript"></script>
<script src="{% static_with_version "cms/js/dist/bundle.admin.base.min.js" %}" type="text/javascript"></script>
<script src="{% static_with_version "cms/js/dist/bundle.admin.changeform.min.js" %}" type="text/javascript"></script>
<script type="text/javascript">
if (!window.jQuery) {
window.jQuery = CMS.$;
window.$ = window.jQuery;
}
</script>
{{ block.super }}
{% endblock %}
{% block content_title %}
{% if title %}<h1>{{ title }}</h1>{% endif %}
{% if not popup and not add %}
<ul class="object-tools hide-in-modal">
<li>
{% url opts|admin_urlname:'preview_page' page.id language as admin_url %}
<a href="{{ admin_url }}" target="_parent">{% trans "View on site" %}</a>
</li>
</ul>
{% endif %}
{% endblock %}
{% block content %}
<div id="content-main">
{% block object-tools %}{% endblock %}
<form {% if has_file_field %}enctype="multipart/form-data"
{% endif %}action="?language={{ language }}{% if request.GET.parent_node %}&amp;parent_node={{ request.GET.parent_node }}{% endif %}{% if request.GET.source %}&amp;source={{ request.GET.source }}{% endif %}"
method="post"
id="page_form">
{% csrf_token %}
{% block form_top %}{% endblock %}
<div style="display: none;"><input type="hidden"
name="language"
value="{{ language }}"
id="id_language"/></div>
{% if show_language_tabs and not show_permissions %}
<div id="page_form_lang_tabs">
{% for lang_code, lang_name in language_tabs %}
<input type="button"
onclick="CMS.API.changeLanguage('./?language={{ lang_code }}');"
class="language_button {% if lang_code == language %}selected{% else %}{% if not lang_code in filled_languages %} notfilled{% endif %}{% endif %}"
id="{{ lang_code }}button"
name="{{ lang_code }}"
value="{{ lang_name }}"/>
{% endfor %}
<div class="lang_tabs_line"></div>
</div>
{% endif %}
<div id="lang_tab_content">
{% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
{% if save_on_top %}{% submit_row %}{% endif %}
{% if errors %}
<p class="errornote">
{% blocktrans count errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
</p>
<ul class="errorlist">{% for error in adminform.form.non_field_errors %}<li>{{ error }}</li>{% endfor %}</ul>
{% endif %}
{% for fieldset in adminform %}
{% include "admin/cms/page/includes/fieldset.html" %}{% endfor %}
{% for inline_admin_formset in inline_admin_formsets %}
{% include inline_admin_formset.opts.template %}{% endfor %}
{% if show_permissions %}
{% if CMS_PERMISSION and can_change_permissions %}
<div class="inline-group">
<div class="tabular inline-related">
<fieldset id="inherited_permissions" class="module aligned collapse">
<h2>{% trans 'All permissions' %}</h2>
<div class="loading" rel="../permissions/">{% trans 'Loading...' %}</div>
</fieldset>
</div>
</div>
{% endif %}
{% endif %}
{% block after_related_objects %}{% endblock %}
{% if add %}
<div class="submit-row" {% if is_popup %} style="overflow: auto;">
<input type="submit" name="_save" class="default" value="{% trans 'Save' %}"/>
<input type="submit" name="_continue" value="{% trans 'Save and continue editing' %}"/>
</div>
{% else %}
{% page_submit_row %}
{% endif %}
</div>
</form>
</div>
{% block admin_change_form_document_ready %}
{{ block.super }}
{% endblock %}
{% for url in unihandecode_urls %}<script src="{{ url }}" type="text/javascript"></script>{% endfor %}
{% if unihandecode_urls %}
<script>
var UNIHANDECODER = unihandecode.Unihan('{{ unihandecode_lang }}');
</script>
{% endif %}
{# JavaScript for prepopulated fields #}
{% prepopulated_fields_js %}
{% endblock %}

View file

@ -0,0 +1,37 @@
{% extends "admin/change_form.html" %}
{% load i18n l10n static cms_static %}
{% block title %}
{% trans "Change a page" %}
{% endblock %}
{% block content %}
{# trick for cms to understand that the plugin was actually correctly saved #}
<div class="messagelist">
<div class="success"></div>
</div>
<script>
window.CMS || window.parent.CMS || document.write(
'<script src="{% static_with_version "cms/js/dist/bundle.admin.base.min.js" %}" type="text/javascript"><\/script>'
);
</script>
<script>
// we have a special case here cause the CMS namespace
// can be either inside the current window or the parent
(function(Window) {
// the dataBridge is used to access plugin information from different resources
// Do NOT move this!!!
Window.CMS.API.Helpers.dataBridge = {{ plugin_data|safe }};
{% if plugin_structure %}
Window.CMS.API.Helpers.dataBridge.structure = {{ plugin_structure|safe }};
{% endif %}
Window.CMS.$(document).ready(function () {
// make sure we're doing after the "modal" mechanism kicked in
setTimeout(function () {
// save current plugin
Window.CMS.API.Helpers.onPluginSave();
}, 100);
});
})(window.parent || window);
</script>
{% endblock %}

View file

@ -0,0 +1 @@
{% extends "admin/includes/fieldset.html" %}

View file

@ -0,0 +1,75 @@
{% load i18n cms_admin cms_tags admin_urls %}
{% if rows %}
<table>
<thead>
<tr>
<th>{% trans "Page" %}</th>
<th>{% trans "User" %}</th>
<th>{% trans "Group" %}</th>
<th>{% trans "Can edit" %}</th>
<th>{% trans "Can add" %}</th>
<th>{% trans "Can delete" %}</th>
<th>{% trans "Can publish" %}</th>
<th>{% trans "Can change permissions" %}</th>
<th>{% trans "Can move" %}</th>
<th>{% trans "Can view" %}</th>
<th>
{% trans "Grant on" %}
</th>
</tr>
</thead>
<tbody>
{% for row in rows %}
{% with permission=row.permission %}
<tr class="{% cycle 'row1' 'row2' %}">
<td class="page">
{% if row.is_global %}
{% if row.can_change %}
<a href="{% cms_admin_url 'cms_globalpagepermission_change' permission.id %}">
{% trans "(global)" %}
</a>
{% else %}
{% trans "(global)" %}
{% endif %}
{% else %}
{% if permission.page_id == page.id %}
{% trans "(current)" %}
{% else %}
{% if row.can_change %}
<a href="{% url opts|admin_urlname:'change' permission.page_id %}">
{{ permission.page }}
</a>
{% else %}
{{ permission.page }}
{% endif %}
{% endif %}
{% endif %}
</td>
<td class="user">{{ permission.user|default_if_none:"-" }}</td>
<td class="group">{{ permission.group|default_if_none:"-" }}</td>
<td class="can_change">{{ permission.can_change|boolean_icon }}</td>
<td class="can_add">{{ permission.can_add|boolean_icon }}</td>
<td class="can_delete">{{ permission.can_delete|boolean_icon }}</td>
<td class="can_publish">{{ permission.can_publish|boolean_icon }}</td>
<td class="can_change_permissions">
{{ permission.can_change_permissions|boolean_icon }}
</td>
<td class="can_move_page">{{ permission.can_move_page|boolean_icon }}</td>
<td class="can_view">{{ permission.can_view|boolean_icon }}</td>
<td class="grant_on">
{% if row.is_global %}
{% trans "All" %}
{% else %}
{{ permission.get_grant_on_display }}
{% endif %}
</td>
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
{% else %}
<p>
{% trans "Page doesn't inherit any permissions." %}
</p>
{% endif %}

View file

@ -0,0 +1,16 @@
{% extends "admin/change_form.html" %}
{% load cms_admin cms_static %}
{% block extrahead %}
{# in case plugins require widgets, they need to have bundle here #}
<script src="{% static_with_version "cms/js/dist/bundle.admin.base.min.js" %}" type="text/javascript"></script>
<script type="text/javascript">
if (!window.jQuery) {
window.jQuery = CMS.$;
window.$ = window.jQuery;
}
</script>
{{ block.super }}
{% endblock %}
{% block submit_buttons_bottom %}
{% submit_row_plugin %}
{% endblock %}

View file

@ -0,0 +1 @@
{% extends "admin/cms/page/close_frame.html" %}

View file

@ -0,0 +1,3 @@
{% extends "admin/delete_confirmation.html" %}
{% load i18n admin_urls cms_tags %}
{% block breadcrumbs %}{% endblock %}

View file

@ -0,0 +1,17 @@
{% extends "admin/change_form.html" %}
{% load i18n l10n static %}
{% block title %}
{% trans "Edit model" %}
{% endblock %}
{% block content %}
<form action="." method="post" id="cmsplugin_form">
{% csrf_token %}
<div>
<fieldset class="module aligned ">
<div class="description">
{{ message }}
</div>
</fieldset>
</div>
</form>
{% endblock %}

View file

@ -0,0 +1,22 @@
{% load i18n admin_urls cms_tags %}
<div class="submit-row">
{% if show_save %}
<input type="submit" value="{% trans 'Save' %}" class="default" name="_save" />
{% endif %}
{% if show_delete_link %}
<p class="deletelink-box">
<a href="{% cms_admin_url "cms_page_delete_plugin" original.pk %}" class="deletelink">
{% trans "Delete" %}
</a>
</p>
{% endif %}
{% if show_save_as_new %}
<input type="submit" value="{% trans 'Save as new' %}" name="_saveasnew" />
{% endif %}
{% if show_save_and_add_another %}
<input type="submit" value="{% trans 'Save and add another' %}" name="_addanother" />
{% endif %}
{% if show_save_and_continue %}
<input type="submit" value="{% trans 'Save and continue editing' %}" name="_continue" />
{% endif %}
</div>

View file

@ -0,0 +1,34 @@
{% load i18n cms_tags admin_urls %}
<div class="submit-row"
{% if is_popup %}style="overflow: auto;" {% endif %}
>
{% if show_save %}
<input type="submit" value="{% trans 'Save' %}" class="default" name="_save" />
{% endif %}
<p class="deletelink-box">
{% if show_delete_link %}
<a href="delete/" class="deletelink">
{% trans "Delete" %}
</a>
{% endif %}
{% if show_buttons %}
<a href="{% url opts|admin_urlname:'change' object_id %}?language={{ language }}"
class="cms-btn-group{% if basic_info_active %}cms-btn-active{% endif %}">
{% trans "Basic Settings" %}
</a>
<a href="{% url opts|admin_urlname:'advanced' object_id %}?language={{ language }}"
class="cms-btn-group{% if advanced_settings_active %}cms-btn-active{% endif %}">
{% trans "Advanced Settings" %}
</a>
{% endif %}
</p>
{% if show_save_as_new %}
<input type="submit" value="{% trans 'Save as new' %}" name="_saveasnew" />
{% endif %}
{% if show_save_and_add_another %}
<input type="submit" value="{% trans 'Save and add another' %}" name="_addanother" />
{% endif %}
{% if show_save_and_continue %}
<input type="submit" value="{% trans 'Save and continue editing' %}" name="_continue" />
{% endif %}
</div>

View file

@ -0,0 +1,162 @@
{% load i18n admin_urls %}
{% spaceless %}
<ul class="cms-pagetree-dropdown-menu-inner">
{% block actions %}
<li
{% if has_copy_page_permission %}
class="js-cms-tree-item-copy" data-id="{{ page.pk }}" data-node-id="{{ node.pk }}" data-apphook="{{ page.application_urls|default_if_none:"" }}"
{% endif %}
>
<a
{% if not has_copy_page_permission %}class="cms-pagetree-dropdown-item-disabled" {% endif %}
href="#" title="{% filter escapejs %}{% trans "Copy" %}
{% endfilter %}
">
<span class="cms-icon cms-icon-copy"></span>
<span>
{% filter escapejs %}{% trans "Copy" %}
{% endfilter %}
<span>
</a>
</li>
<li
{% if has_move_page_permission %}
class="js-cms-tree-item-cut" data-id="{{ page.pk }}" data-node-id="{{ node.pk }}"
{% endif %}
>
<a
{% if not has_move_page_permission %}class="cms-pagetree-dropdown-item-disabled" {% endif %}
href="#" title="{% filter escapejs %}{% trans "Cut" %}{% endfilter %}
">
<span class="cms-icon cms-icon-scissors"></span>
<span>
{% filter escapejs %}{% trans "Cut" %}{% endfilter %}
<span>
</a>
</li>
<li>
<a href="#"
data-id="{{ page.pk }}"
data-node-id="{{ node.pk }}"
class="{% if has_add_permission %}js-cms-tree-item-paste{% endif %} {% if not has_add_permission or not paste_enabled %} cms-pagetree-dropdown-item-disabled{% endif %}">
<span class="cms-icon cms-icon-alias"></span>
<span>{% filter escapejs %}{% trans "Paste" %}{% endfilter %}</span>
</a>
</li>
<li>
{% if has_delete_permission %}
<a href="{% url opts|admin_urlname:'delete' page.id %}?language={{ preview_language }}"
title="{% filter escapejs %}{% trans ">
{% else %}
<a href="#" class="cms-pagetree-dropdown-item-disabled">
{% endif %}
<span class="cms-icon cms-icon-bin"></span>
<span>{% filter escapejs %}{% trans "Delete" %}...{% endfilter %}</span>
</a>
</li>
{% if has_change_permission and page.is_potential_home %}
<li class="js-cms-tree-item-set-home">
<a href="{% url opts|admin_urlname:'set_home' page.id %}"
title="{% filter escapejs %}{% trans ">
<span class="cms-icon cms-icon-home"></span>
<span>{% filter escapejs %}{% trans "Set as home" %}{% endfilter %}</span>
</a>
</li>
{% else %}
<li class="js-cms-tree-item-set-home">
<a href="#" class="cms-pagetree-dropdown-item-disabled">
<span class="cms-icon cms-icon-home"></span>
<span>{% filter escapejs %}{% trans "Set as home" %}{% endfilter %}</span>
</a>
</li>
{% endif %}
<li>
{% if has_change_advanced_settings_permission %}
<a href="{% url opts|admin_urlname:'advanced' page.id %}"
title="{% filter escapejs %}{% trans ">
{% else %}
<a href="#" class="cms-pagetree-dropdown-item-disabled">
{% endif %}
<span class="cms-icon cms-icon-cogs"></span>
<span>{% filter escapejs %}{% trans "Advanced settings" %}{% endfilter %}</span>
</a>
</li>
{% if CMS_PERMISSION %}
<li>
{% if has_change_permissions_permission %}
<a href="{% url opts|admin_urlname:'permissions' page.id %}"
title="{% filter escapejs %}{% trans ">
{% else %}
<a href="#" class="cms-pagetree-dropdown-item-disabled">
{% endif %}
<span class="cms-icon cms-icon-lock"></span>
<span>{% filter escapejs %}{% trans "Permissions" %}{% endfilter %}</span>
</a>
</li>
{% endif %}
{% endblock actions %}
<li class="cms-pagetree-dropdown-separator">
&nbsp;
</li>
<li>
{% if page.publication_date %}
<p title="{% filter escapejs %}{% trans ">
<strong>{% filter escapejs %}{% trans "publication date" %}{% endfilter %}:</strong>
{{ page.publication_date|date:"Y-m-d" }}
</p>
{% endif %}
{% if page.publication_end_date %}
<p title="{% filter escapejs %}{% trans ">
<strong>{% filter escapejs %}{% trans "publication end date" %}{% endfilter %}:</strong>
{{ page.publication_end_date|date:"Y-m-d" }}
</p>
{% endif %}
<p title="{% filter escapejs %}{% trans ">
<strong>{% filter escapejs %}{% trans "is restricted" %}{% endfilter %}:</strong>
{% if page_is_restricted %}
{% filter escapejs %}{% trans "Yes" %}{% endfilter %}
{% else %}
{% filter escapejs %}{% trans "No" %}{% endfilter %}
{% endif %}
</p>
{% if page.changed_by %}
<p title="{% filter escapejs %}{% trans ">
<strong>{% filter escapejs %}{% trans "last change by" %}{% endfilter %}:</strong>
{{ page.changed_by }}
</p>
{% endif %}
{% if page.changed_date %}
<p title="{% filter escapejs %}{% trans ">
<strong>
{% filter escapejs %}{% trans "last change on" %}{% endfilter %}:
</strong>
{{ page.changed_date|date:"Y-m-d H:i:s" }}
</p>
{% endif %}
{% if page.get_template_display %}
<p title="{% filter escapejs %}{% trans ">
<strong>
{% filter escapejs %}{% trans "template" %}{% endfilter %}:
</strong>
{{ page.get_template_display }}
</p>
{% endif %}
{% if metadata %}
<p title="{% filter escapejs %}{% trans ">
<strong>
{% filter escapejs %}{% trans "meta" %}{% endfilter %}:
</strong>
{{ metadata }}
</p>
{% endif %}
{% if page.site %}
<p title="{% filter escapejs %}{% trans ">
<strong>
{% filter escapejs %}{% trans "site" %}{% endfilter %}:
</strong>
{{ page.site }}
</p>
{% endif %}
</li>
</ul>
{% endspaceless %}

View file

@ -0,0 +1,182 @@
{% extends "admin/change_list.html" %}
{% load i18n admin_list static admin_urls cms_admin cms_js_tags cms_static cms_tags %}
{# TODO might not need that #}
{% block title %}{% trans "List of pages" %}{% endblock %}
{% block bodyclass %}{{ block.super }} change-list cms-pagetree-wrapper{% endblock %}
{% block coltype %}flex{% endblock %}
{% block date_hierarchy %}{% endblock %}
{% block pagination %}{% endblock %}
{% block extrahead %}
{{ block.super }}
{# INFO: we need to add styles here instead of "extrastyle" to avoid conflicts with adminstyle #}
<link rel="stylesheet" href="{% static_with_version 'cms/css/cms.base.css' %}">
<link rel="stylesheet" href="{% static_with_version 'cms/css/cms.pagetree.css' %}">
<script src="{% static_with_version 'cms/js/dist/bundle.admin.base.min.js' %}"></script>
<script src="{% static_with_version 'cms/js/dist/bundle.admin.pagetree.min.js' %}"></script>
{% endblock extrahead %}
{% if not is_popup %}
{% block breadcrumbs %}
<div class="breadcrumbs cms-pagetree-breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans "Home" %}</a> &rsaquo;
<a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a> &rsaquo;
{{ opts.verbose_name_plural|capfirst|escape }}
{# TODO might remove this or add reset #}
{% if request.GET.q or request.POST.q %}
&rsaquo; {% trans "Search" %}
{% endif %}
</div>
{% endblock %}
{% endif %}
{% block content_title %}{% endblock %}
{% block content %}
{% spaceless %}
<div id="content-main">
<div class="cms-pagetree-root module{% if tree.is_filtered %} filtered{% endif %}" id="changelist">
<div class="cms-pagetree cms-pagetree-header">
<div class="cms-pagetree-header-cell cms-pagetree-header-cell-fluid">
<div class="cms-pagetree-header-row cms-pagetree-search-container">
<div class="cms-pagetree-header-cell">
<div class="cms-pagetree-header-title">
<h1>
{% trans "Page Tree" %} <span>({{ tree.site.name }})</span>
</h1>
</div>
{% if tree.is_filtered or request.GET.q %}
{# INFO: show reset button when filtering is active #}
<a href="{% url opts|admin_urlname:'changelist' %}" class="cms-pagetree-header-cell cms-pagetree-header-search-reset">{% trans "Reset filter"|lower %}</a>
{% endif %}
</div>
<div class="cms-pagetree-header-cell cms-pagetree-header-cell-search">
{# INFO: visible search field with filtering #}
<form method="get" class="cms-pagetree-header-search js-cms-pagetree-header-search">
<label for="field-searchbar" class="cms-hidden">{% trans "Search" %}</label>
<div class="cms-pagetree-header-filter">
<input type="text" size="40" name="q" id="field-searchbar" value="{{ tree.query }}" placeholder="{% trans "Search" %}">
<div class="cms-pagetree-header-filter-trigger js-cms-pagetree-header-filter-trigger">
<a href="#"><span class="cms-icon cms-icon-arrow"></span></a>
</div>
<div class="cms-pagetree-header-filter-container js-cms-pagetree-header-filter-container">
{% for field in changelist_form.visible_fields %}
{% render_filter_field request field %}
{% endfor %}
<a href="#" class="cms-pagetree-header-search-close js-cms-pagetree-header-search-close">
<span class="cms-icon cms-icon-close"></span>
</a>
</div>
</div>
<button type="submit" class="cms-pagetree-header-search-btn">
<span class="cms-icon cms-icon-search"></span>
</button>
</form>
</div>
</div>
</div>
<div class="cms-pagetree-header-cell cms-pagetree-header-body">
{# INFO: hidden search field with dynamic content #}
<div class="js-cms-pagetree-header-search-copy cms-hidden">
<div id="toolbar">
<form id="changelist-search" method="get">
<div><!-- DIV needed for valid HTML -->
<label for="searchbar"><img src="{% static "admin/img/search.svg" %}" alt="Search" /></label>
<input type="text" size="40" name="{{ search_var }}" value="{{ tree.query }}" id="searchbar" autofocus />
<input type="submit" value="{% trans 'Search' %}" />
{% for pair in changelist_form.get_filter_items %}
{% if pair.0 != search_var %}<input type="hidden" name="{{ pair.0 }}" value="{{ pair.1 }}"/>{% endif %}
{% endfor %}
</div>
</form>
</div>
</div>
<div class="cms-clear-mobile"></div>
{# INFO: dropdown for changing sites and recover deleted pages #}
<div class="cms-pagetree-sites-list cms-pagetree-dropdown js-cms-pagetree-dropdown">
<a href="#" class="cms-pagetree-dropdown-trigger js-cms-pagetree-dropdown-trigger">
<span class="cms-icon cms-icon-squares"></span>
</a>
<div class="cms-pagetree-dropdown-menu cms-pagetree-dropdown-menu-condensed cms-pagetree-dropdown-menu-arrow-top-right js-cms-pagetree-dropdown-menu">
<ul class="cms-pagetree-dropdown-menu-inner">
<li>
<span class="label">{% trans "Sites" %}</span>
</li>
{% for site in tree.sites %}
<li{% if site.pk == tree.site.pk %} class="active"{% endif %}>
<a href="#{{ site.pk }}" class="js-cms-pagetree-site-trigger" data-id="{{ site.pk }}">{{ site.name }}</a>
</li>
{% endfor %}
{% if has_recover_permission %}
<li class="cms-pagetree-dropdown-separator">&nbsp;</li>
<li>
<a href="{% url opts|admin_urlname:'recoverlist' %}" class="recoverlink">
{% blocktrans with opts.verbose_name_plural|escape as name %}
Restore deleted {{ name }}
{% endblocktrans %}
</a>
</li>
{% endif %}
</ul>
</div>
{# INFO: hidden site form when using the dropdown site switcher #}
<form method="post" class="js-cms-pagetree-site-form cms-hidden">
<select name="site">
{% for site in tree.sites %}
<option value="{{ site.pk }}">{{ site.name }}</option>
{% endfor %}
</select>
{% csrf_token %}
</form>
</div>
{# INFO: "new page" button #}
{% if has_add_permission %}
<a href="{% url opts|admin_urlname:'add' %}" class="cms-pagetree-header-create cms-btn cms-btn-toolbar cms-btn-action">
{% blocktrans with opts.verbose_name|title as name %}
New {{ name }}
{% endblocktrans %}
</a>
{% endif %}
</div>
</div>
<form id="changelist-form" action="" method="post" novalidate>{% csrf_token %}
<div class="cms-pagetree cms-pagetree-section">
<h2>{% trans "Main Navigation" %}</h2>
<div class="cms-pagetree-section-nav">
{% if has_add_permission %}
<div class="cms-pagetree-dropdown js-cms-pagetree-dropdown">
<a href="#root" data-node-id="#root" data-id="#root" class="js-cms-pagetree-dropdown-trigger js-cms-pagetree-options cms-pagetree-dropdown-trigger cms-btn cms-btn-default cms-btn-no-border cms-icon cms-icon-menu">
<span class="sr-only">{% trans "Options" %}</span>
</a>
<div class="js-cms-pagetree-dropdown-menu cms-pagetree-dropdown-menu cms-pagetree-dropdown-menu-arrow-right-top">
<ul class="cms-pagetree-dropdown-menu-inner">
<li>
<a href="#" data-node-id="#root" data-id="#root" class="js-cms-tree-item-paste cms-pagetree-dropdown-item-disabled">
<span class="cms-icon cms-icon-alias"></span>
<span>{% trans "Paste" %}</span>
</a>
</li>
</ul>
</div>
</div>
{% endif %}
</div>
</div>
{# INFO: javascript is loaded from cms.pagetree.js #}
</form>
{# INFO: used when copying nodes #}
<div class="cms-tree-dialog js-cms-tree-dialog"></div>
</div>
</div>
{% endspaceless %}
{% endblock content %}

View file

@ -0,0 +1,16 @@
{% load i18n %}
<div class="cms-dialog js-cms-dialog js-cms-dialog-{{ dialog_id }}">
<h1>{% trans "Copy options" %}</h1>
<p>
{% trans "Choose copy options" %}
</p>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<div class="submit-row">
<input type="submit" value="{% trans 'Save' %}" class="default submit">
<input type="submit" value="{% trans 'Close' %}" class="cancel">
</div>
</form>
</div>
<div class="cms-dialog-dimmer js-cms-dialog-dimmer"></div>

View file

@ -0,0 +1,13 @@
{% load i18n %}
<h3>{{ field.label }}</h3>
<ul>
{% for choice in choices %}
<li
{% if choice.selected %}class="selected" {% endif %}
>
<a href="{{ choice.query_string|iriencode }}">
{{ choice.display }}
</a>
</li>
{% endfor %}
</ul>

View file

@ -0,0 +1,77 @@
{% load i18n %}
{% spaceless %}
<div class="cms-pagetree cms-pagetree-section cms-pagetree-section-condensed cms-pagetree-legend">
<span class="cms-pagetree-dropdown js-cms-pagetree-dropdown">
<div class="js-cms-pagetree-dropdown-trigger cms-pagetree-legend-title-wrap">
<span class="cms-icon cms-icon-info"></span>
<span class="cms-pagetree-legend-title">
{% trans "Legend" %}
</span>
</div>
<div class="cms-pagetree-dropdown-menu cms-pagetree-dropdown-menu-condensed cms-pagetree-dropdown-menu-arrow-right-bottom js-cms-pagetree-dropdown-menu">
<ul class="cms-pagetree-dropdown-menu-inner">
<li>
<span class="cms-pagetree-dropdown-item">
<span class="cms-pagetree-node-state cms-pagetree-node-state-published"></span>
<span>{% trans "Published" %}</span>
</span>
</li>
<li>
<span class="cms-pagetree-dropdown-item">
<span class="cms-pagetree-node-state cms-pagetree-node-state-dirty"></span>
<span>{% trans "Changed" %}</span>
</span>
</li>
<li>
<span class="cms-pagetree-dropdown-item">
<span class="cms-pagetree-node-state cms-pagetree-node-state-unpublished"></span>
<span>{% trans "Unpublished" %}</span>
</span>
</li>
<li>
<span class="cms-pagetree-dropdown-item">
<span class="cms-pagetree-node-state cms-pagetree-node-state-empty"></span>
<span>{% trans "Empty" %}</span>
</span>
</li>
<li>
<span class="cms-pagetree-dropdown-item">
<span class="cms-icon cms-icon-check-square"></span>
<span>{% trans "In menu" %}</span>
</span>
</li>
<li>
<span class="cms-pagetree-dropdown-item">
<span class="cms-icon cms-icon-minus-square"></span>
<span>{% trans "Not in menu" %}</span>
</span>
</li>
<li>
<span class="cms-pagetree-dropdown-item">
<span class="cms-icon cms-icon-eye"></span>
<span>{% trans "View page" %}</span>
</span>
</li>
<li>
<span class="cms-pagetree-dropdown-item">
<span class="cms-icon cms-icon-home"></span>
<span>{% trans "Home" %}</span>
</span>
</li>
<li>
<span class="cms-pagetree-dropdown-item">
<span class="cms-icon cms-icon-sitemap"></span>
<span>{% trans "Softroot" %}</span>
</span>
</li>
<li>
<span class="cms-pagetree-dropdown-item">
<span class="cms-icon cms-icon-puzzle"></span>
<span>{% trans "Apphook" %}</span>
</span>
</li>
</ul>
</div>
</span>
</div>
{% endspaceless %}

View file

@ -0,0 +1,282 @@
{% load i18n cms_admin admin_urls %}
{# INFO: columns are defined in base.html options #}
{% spaceless %}
<li class="cms-tree-node {{ css_class }}
{% if follow_descendants %}{% if descendants %} jstree-open{% elif node.is_branch %} jstree-closed{% endif %}{% endif %}
{% if page.reverse_id == 'page_types' %} cms-tree-node-pagetype{% endif %}
{% if node.depth == 0 %} cms-tree-node-top{% endif %}
{% if filtered %} cms-tree-node-filtered{% endif %}
{% if has_add_permission %} cms-tree-node-root-allow-children{% endif %}
{% block extra_class %}
{% if is_shared_page %}
cms-tree-node-shared-true
{% else %}
cms-tree-node-shared-false
{% endif %}
{% endblock %}
"
{% if is_popup %}onclick="opener.dismissRelatedLookupPopup(window, {{ page.id }}); return false;"{% endif %}
data-id="{{ page.pk }}"
data-node-id="{{ node.pk }}"
data-slug="{{ page.get_slug }}"
data-is-home="{{ page.is_home|yesno:"true,false" }}"
data-move-permission="{{ has_move_page_permission|yesno:"true,false" }}"
data-add-permission="{{ has_add_page_permission|yesno:"true,false" }}"
{% block extra_data %}
{% if is_shared_page %}
data-shared-page="-true"
{% else %}
data-shared-page="-false"
{% endif %}
{% endblock %}
data-colview='
<div class="cms-tree-col">
<div class="cms-tree-item-wrapper">
{% block row_icon %}
{% if page.is_home %}
<div class="cms-tree-item cms-tree-item-icons">
<div class="cms-tree-item-inner">
<div class="cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
data-cms-tooltip="{% autoescape on %}{% trans 'Home' %}{% endautoescape %}">
<span class="cms-icon cms-icon-home"></span>
</div>
</div>
</div>
{% endif %}
{% if page.soft_root %}
<div class="cms-tree-item cms-tree-item-icons">
<div class="cms-tree-item-inner">
<div class="cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
data-cms-tooltip="{% autoescape on %}{% trans 'Softroot' %}{% endautoescape %}">
<a href="{% url opts|admin_urlname:'advanced' page.id %}">
<span class="cms-icon cms-icon-sitemap"></span>
</a>
</div>
</div>
</div>
{% endif %}
{% if page.application_urls %}
<div class="cms-tree-item cms-tree-item-icons">
<div class="cms-tree-item-inner">
<div class="cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
data-cms-tooltip="{% autoescape on %}{% blocktrans with page.application_urls as apphook%}Application: {{ apphook }}{% endblocktrans %}{% endautoescape %}">
<a href="{% url opts|admin_urlname:'advanced' page.id %}">
<span class="cms-icon cms-icon-puzzle"></span>
</a>
</div>
</div>
</div>
{% endif %}
{% endblock %}
</div>
</div>
'
data-colpreview='
<div class="cms-tree-col">
<div class="cms-tree-item cms-tree-item-preview
{# INFO: highlight active icon when in sidebar mode #}
{% if page.id|slugify == request.GET.page_id|slugify %} cms-tree-preview-active{% endif %}">
<div class="cms-tree-item-inner cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay" data-cms-tooltip="{% autoescape on %}{% trans "View on site" %}{% endautoescape %}">
<a class="js-cms-pagetree-page-view" href="{% url opts|admin_urlname:'preview_page' page.id lang %}"{% if lang in page_languages %} target="_top"{% endif %}">
<span class="sr-only">{% autoescape on %}{% trans "View on site" %}{% endautoescape %}</span>
</a>
</div>
</div>
</div>
'
{% for lang in site_languages %}
data-col{{ lang|lower|cut:'-' }}='
<div class="cms-tree-col">
<div class="cms-tree-item {% if is_shared_page or not has_publish_permission %} cms-tree-item-disabled{% endif %} cms-tree-item-lang">
<div class="cms-tree-item-inner cms-pagetree-dropdown{% if has_publish_permission %} js-cms-pagetree-dropdown{% endif %}">
{% if has_publish_permission %}
<a href="{% url opts|admin_urlname:'preview_page' page.id lang %}"
class="cms-pagetree-dropdown-trigger js-cms-pagetree-dropdown-trigger"
{# INFO: delegate click event to parent window when in sideframe #}
{% if lang in page_languages %} target="_top"{% endif %}>
{# INFO: renders <span class="{cls}" title="{title}"></span> #}
{% tree_publish_row page lang %}
</a>
<div class="cms-pagetree-dropdown-menu cms-pagetree-dropdown-menu-arrow-right-top js-cms-pagetree-dropdown-menu">
<ul class="cms-pagetree-dropdown-menu-inner">
<li>
<a href="{% url opts|admin_urlname:'preview_page' page.id lang %}" class="js-cms-pagetree-page-view" target="_top">
<span class="cms-icon cms-icon-eye" title="{% autoescape on %}{% blocktrans with lang|upper as language %}Preview this page in {{ language }} {% endblocktrans %}{% endautoescape %}"></span>
<span>{% autoescape on %}{% trans "Preview" %}{% endautoescape %}</span>
</a>
</li>
{# hide if page is empty #}
{% if lang in page_languages %}
{% if ancestors|items_are_published:lang %}
{% if page|is_dirty:lang or not page|is_published:lang %}
<li>
<a href="{% url opts|admin_urlname:'publish_page' page.id lang %}?redirect_language={{ preview_language }}{% if request.GET.page_id %}&amp;redirect_page_id={{ request.GET.page_id }}{% endif %}" class="js-cms-tree-lang-trigger">
<span class="cms-icon cms-icon-check-o"></span>
<span>{% autoescape on %}{% trans "Publish" %}{% endautoescape %}</span>
</a>
</li>
{% endif %}
{% if page|is_published:lang %}
<li>
<a href="{% url opts|admin_urlname:'unpublish' page.id lang %}?redirect_language={{ preview_language }}{% if request.GET.page_id %}&amp;redirect_page_id={{ request.GET.page_id }}{% endif %}" class="js-cms-tree-lang-trigger">
<span class="cms-icon cms-icon-forbidden"></span>
<span>{% autoescape on %}{% trans "Unpublish" %}{% endautoescape %}</span>
</a>
</li>
{% endif %}
{% endif %}
{% else %}
<li>
<a href="{% url opts|admin_urlname:'change' page.id %}?language={{ lang }}">
<span class="cms-icon cms-icon-cogs"></span>
<span>{% autoescape on %}{% trans "Configure" %}{% endautoescape %}</span>
</a>
</li>
{% endif %}
</ul>
</div>
{% else %}
<span class="cms-tree-lang-container">
{% tree_publish_row page lang %}
</span>
{% endif %}
</div>
</div>
</div>
'
{% endfor %}
data-colmenu='
<div class="cms-tree-col">
<div class="cms-tree-item cms-tree-item-menu{% if not has_change_permission %} cms-tree-item-disabled{% endif %} js-cms-tree-item-menu">
<div class="cms-tree-item-inner">
{% if has_change_permission %}
<a href="{% url opts|admin_urlname:'change_innavigation' page.id %}?language={{ preview_language }}&amp;{{ page.id }}={{ page.in_navigation|yesno:"1,0" }}">
{% endif %}
{% if page.in_navigation %}
<div class="cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
data-cms-tooltip="{% autoescape on %}{% trans "in menu" %}{% endautoescape %}">
<span class="cms-icon cms-icon-check-square"></span>
</div>
{% else %}
<div class="cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
data-cms-tooltip="{% autoescape on %}{% trans "not in menu" %}{% endautoescape %}">
<span class="cms-icon cms-icon-minus-square"></span>
</div>
{% endif %}
{% if has_change_permission %}
</a>
{% endif %}
</div>
</div>
</div>
'
data-coloptions='
<div class="cms-tree-col cms-tree-col-padding-sm">
<div class="cms-tree-item-wrapper">
<div class="cms-tree-item cms-tree-item-button">
<div{% if has_change_permission and has_change_advanced_settings_permission %} class="cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
data-cms-tooltip="{% autoescape on %}{% trans "Page settings (SHIFT click for advanced settings)" %}{% endautoescape %}"{% endif %}>
{% if has_change_permission or has_change_advanced_settings_permission %}
<a {% if has_change_permission %}href="{% url opts|admin_urlname:'change' page.id %}?language={{ preview_language }}" {% endif %}
class="cms-btn cms-btn-default js-cms-tree-advanced-settings cms-icon cms-icon-pencil"
{% if has_change_advanced_settings_permission %}
data-url="{% url opts|admin_urlname:'advanced' page.id %}"
{% endif %}
>
{% else %}
<span class="cms-btn cms-btn-default cms-btn-disabled js-cms-tree-advanced-settings cms-icon cms-icon-pencil">
{% endif %}
<span class="sr-only">{% autoescape on %}{% trans "Page settings (SHIFT click for advanced settings)" %}{% endautoescape %}</span>
{% if has_change_permission or has_change_advanced_settings_permission %}
</a>
{% endif %}
</div>
</div>
<div class="cms-tree-item cms-tree-item-button">
<div{% if has_add_page_permission %} class="cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
data-cms-tooltip="{% autoescape on %}{% trans 'New sub page' %}{% endautoescape %}"{% endif %}>
{% if has_add_page_permission %}
<a href="{% url opts|admin_urlname:'add' %}?parent_node={{ node.pk }}"
class="js-cms-pagetree-add-page cms-btn cms-btn-default cms-icon cms-icon-plus">
{% else %}
<span class="cms-btn cms-btn-default cms-btn-disabled cms-icon cms-icon-plus">
{% endif %}
<span class="sr-only">{% autoescape on %}{% trans 'New sub page' %}{% endautoescape %}</span>
{% if has_add_page_permission %}
</a>
{% else %}
</span>
{% endif %}
</div>
</div>
<div class="js-cms-pagetree-actions-dropdown cms-tree-item cms-tree-item-button cms-pagetree-dropdown js-cms-pagetree-dropdown" data-lazy-url="{% url opts|admin_urlname:'actions_menu' page.id %}">
<a data-node-id="{{ node.pk }}" data-id="{{ page.pk }}" href="#" class="js-cms-pagetree-dropdown-trigger js-cms-pagetree-options cms-pagetree-dropdown-trigger cms-btn cms-btn-default cms-btn-no-border cms-icon cms-icon-menu">
<span class="sr-only">{% autoescape on %}{% trans "Options" %}{% endautoescape %}</span>
</a>
<div class="js-cms-pagetree-dropdown-menu cms-pagetree-dropdown-menu cms-pagetree-dropdown-menu-arrow-right-top">
<div class="js-cms-pagetree-dropdown-loader cms-pagetree-dropdown-loader">
</div>
{# dummy structure #}
<ul class="cms-pagetree-dropdown-menu-inner">
<li>
<a class="cms-pagetree-dropdown-item-disabled" href="#" title="{% autoescape on %}{% trans 'Copy' %}{% endautoescape %}">
<span class="cms-icon cms-icon-copy"></span>
<span>{% autoescape on %}{% trans 'Copy' %}{% endautoescape %}<span>
</a>
</li>
<li class="">
<a href="#" class="cms-pagetree-dropdown-item-disabled" title="{% autoescape on %}{% trans 'Cut' %}{% endautoescape %}">
<span class="cms-icon cms-icon-scissors"></span>
<span>{% autoescape on %}{% trans 'Cut' %}{% endautoescape %}<span>
</a>
</li>
<li>
<a href="#" data-node-id="{{ node.pk }}" data-id="{{ page.pk }}" class="cms-pagetree-dropdown-item-disabled">
<span class="cms-icon cms-icon-alias"></span>
<span>{% autoescape on %}{% trans "Paste" %}{% endautoescape %}</span>
</a>
</li>
<li>
<a class="cms-pagetree-dropdown-item-disabled" href="#" title="{% autoescape on %}{% trans 'Delete' %}{% endautoescape %}">
<span class="cms-icon cms-icon-bin"></span>
<span>{% autoescape on %}{% trans 'Delete' %}...{% endautoescape %}</span>
</a>
</li>
<li>
<a class="cms-pagetree-dropdown-item-disabled" href="#" title="{% autoescape on %}{% trans "Advanced settings" %}{% endautoescape %}">
<span class="cms-icon cms-icon-cogs"></span>
<span>{% autoescape on %}{% trans "Advanced settings" %}{% endautoescape %}</span>
</a>
</li>
{% if CMS_PERMISSION %}
<li>
<a href="#" class="cms-pagetree-dropdown-item-disabled">
<span class="cms-icon cms-icon-lock"></span>
<span>{% autoescape on %}{% trans "Permissions" %}{% endautoescape %}</span>
</a>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
</div>
'
{% block extra_cols %}{% endblock %}
>
{% language LANGUAGE_CODE %}
{{ page.get_admin_tree_title }}
{% endlanguage %}
{# INFO render children #}
{% if descendants %}
<ul>
{% show_admin_menu_for_pages descendants depth=node.depth|add:1 %}
</ul>
{% endif %}
</li>
{% endspaceless %}

View file

@ -0,0 +1,50 @@
{% extends "admin/change_form.html" %}
{% load i18n cms_tags %}
{% block extrahead %}
{{ block.super }}
<script>
// we have to wait till the window is loaded, otherwise
// the sideframe code will override the url, because every time
// the iframe is loaded, it's current url is saved in the settings
window.onload = function () {
// we have to setTimeout here because the cms.sideframe load event
// fires after this one :(
setTimeout(function () {
var CMS = window.parent.CMS;
// we need to reload the parent window once "?reload_window" is defined and
// set the new url for the sideframe with the correct language specification
if (location.href.indexOf('reload_window') > -1 && CMS) {
// save url in settings
CMS.settings.sideframe.url = window.location.href.replace(/[?&]reload_window/, '');
CMS.settings = CMS.API.Helpers.setSettings(CMS.settings);
// reload everything
CMS.API.Helpers.reloadBrowser();
}
}, 0);
}
</script>
{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% cms_admin_url 'index' %}">
{% trans 'Home' %}
</a>
&rsaquo;
<a href="{% cms_admin_url 'app_list' app_label=opts.app_label %}">
{{ app_label|capfirst|escape }}
</a>
&rsaquo; {{ opts.verbose_name_plural|capfirst }}
&rsaquo;
{% if add %}
{% trans 'Add' %} {{ opts.verbose_name }}
{% else %}
{{ original|truncatewords:"18" }}
{% endif %}
</div>
{% endblock %}
{% block object-tools %}{% endblock %}
{% block submit_buttons_bottom %}
<div class="submit-row">
<input type="submit" value="{% trans 'Save' %}" class="default" name="_save" {{ onclick_attrib }}/>
</div>
{% endblock %}

View file

@ -0,0 +1 @@
{{ content }}

View file

@ -0,0 +1 @@
{% extends template %}

View file

@ -0,0 +1,4 @@
{% load cms_alias_tags %}
{% if request and not instance.is_recursive %}
{% render_alias_plugin instance %}
{% endif %}

View file

@ -0,0 +1,8 @@
{% load i18n cms_admin %}
<div class="cms-clipboard" data-title="{% trans 'Clipboard' %}">
<div class="cms-plugins"></div>
<div class="cms-clipboard-containers cms-dragarea cms-draggables">
{% if clipboard_plugin %}
{% include cms_toolbar.templates.drag_item_template with clipboard="true" plugin=clipboard_plugin %}{% endif %}
</div>
</div>

View file

@ -0,0 +1,2 @@
{% if edit and placeholder %}{{ placeholder }}{% endif %}
{{ content }}

View file

@ -0,0 +1,66 @@
{% load i18n l10n cms_tags %}
<div class="cms-dragbar cms-dragbar-{{ placeholder.pk|unlocalize }}">
<div class="cms-submenu-btn cms-submenu-add cms-btn">
<span class="cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
data-cms-tooltip="{% trans "></span>
</div>
<div class="cms-submenu-settings cms-submenu-btn cms-btn"></div>
<div class="cms-submenu-dropdown cms-submenu-dropdown-settings" data-touch-action="pan-y">
<div class="cms-dropdown-inner">
<div class="cms-submenu-item">
<a data-cms-icon="copy" data-rel="copy" href="#">
{% trans "Copy all" %}
</a>
</div>
{% for language in placeholder.get_filled_languages %}
{% if language.code != LANGUAGE_CODE %}
<div class="cms-submenu-item">
<a data-cms-icon="copy" data-rel="copy-lang" data-language="{{ language.code }}" href="#">
{% trans "Copy from" %} {% trans language.name %}
</a>
</div>
{% endif %}
{% endfor %}
<div class="cms-submenu-item">
<a data-cms-icon="paste" data-rel="paste" href="#">
{% trans "Paste" %}
</a>
</div>
<div class="cms-submenu-item">
<a data-cms-icon="bin"
data-rel="modal"
href="{{ placeholder.get_clear_url }}?language={{ LANGUAGE_CODE }}"
data-name="{{ placeholder.get_label }}">
{% trans "Empty all" %}
</a>
</div>
{% render_extra_menu_items placeholder %}
</div>
</div>
<div class="cms-plugin-picker" data-touch-action="pan-y">
<div class="cms-quicksearch">
<label>
<input type="text" placeholder="{% trans 'Filter plugins...' %}" />
</label>
</div>
{# plugin child classes here #}
</div>
<div class="cms-dragbar-title" title="{{ placeholder.get_label }}">
{{ placeholder.get_label }}
{% if placeholder.is_static %}
<span class="cms-hover-tooltip cms-hover-tooltip-right"
tabindex="-1"
data-cms-tooltip="{% trans 'This is a static placeholder' %}">
<span class="cms-icon cms-icon-pin cms-dragarea-static-icon"></span>
</span>
{% endif %}
<span class="cms-dragbar-toggler">
<a href="#" class="cms-dragbar-expand-all" tabindex="-1">
{% trans "Expand all" %}
</a>
<a href="#" class="cms-dragbar-collapse-all" tabindex="-1">
{% trans "Collapse all" %}
</a>
</span>
</div>
</div>

View file

@ -0,0 +1,77 @@
{% load i18n l10n cms_tags %}
{% with allow_children=plugin.get_plugin_class.allow_children disable_child_plugins=plugin.get_plugin_class.disable_child_plugins %}
<div class="cms-draggable cms-draggable-{{ plugin.pk|unlocalize }} {% if not allow_children %}cms-draggable-disabled{% endif %} {% if clipboard %}cms-draggable-from-clipboard{% endif %}">
<div class="cms-dragitem cms-dragitem-handler {% if plugin.child_plugin_instances %}cms-dragitem-collapsable{% endif %}">
{% if not disabled_child %}
<div class="cms-submenu-btn cms-submenu-edit cms-btn" data-rel="edit">
<span class="cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
data-cms-tooltip="{% trans "></span>
</div>
<div class="cms-submenu-btn cms-submenu-add cms-btn {% if not allow_children %}cms-btn-disabled{% endif %}">
{% if not allow_children %}
<span class="cms-hover-tooltip" data-cms-tooltip="{% trans "></span>
{% else %}
<span class="cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
data-cms-tooltip="{% trans "></span>
{% endif %}
</div>
<div class="cms-submenu cms-submenu-settings cms-submenu-btn cms-btn"></div>
{% else %}
<div class="cms-hover-tooltip cms-hover-tooltip-left cms-plugin-disabled" tabindex="-1" data-cms-tooltip="{% trans ">
<span class="cms-icon cms-icon-lock"></span>
</div>
{% endif %}
<div class="cms-submenu-dropdown cms-submenu-dropdown-settings">
<div class="cms-dropdown-inner">
<div class="cms-submenu-item">
<a data-cms-icon="scissors" data-rel="cut" href="#">
{% trans "Cut" %}
</a>
</div>
<div class="cms-submenu-item">
<a data-cms-icon="copy" data-rel="copy" href="#">
{% trans "Copy" %}
</a>
</div>
<div class="cms-submenu-item">
<a data-cms-icon="paste" data-rel="paste" href="#">
{% trans "Paste" %}
</a>
<span class="cms-submenu-item-paste-tooltip cms-submenu-item-paste-tooltip-empty cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
data-cms-tooltip="{% trans "></span>
<span class="cms-submenu-item-paste-tooltip cms-submenu-item-paste-tooltip-restricted cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
data-cms-tooltip="{% trans "></span>
<span class="cms-submenu-item-paste-tooltip cms-submenu-item-paste-tooltip-disabled cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
data-cms-tooltip="{% trans "></span>
</div>
<div class="cms-submenu-item">
<a data-cms-icon="bin" data-rel="delete" href="#">
{% trans "Delete" %}
</a>
</div>
{% render_extra_menu_items plugin %}
</div>
</div>
{% if not clipboard %}
<div class="cms-plugin-picker" data-touch-action="pan-y">
<div class="cms-quicksearch">
<label>
<input type="text" placeholder="{% trans 'Filter plugins...' %}" />
</label>
</div>
{# plugin child classes here #}
</div>
{% endif %}
<span class="cms-dragitem-text" title="{{ plugin.plugin_type }} ID: {{ plugin.pk }}">
<strong>{{ plugin.get_plugin_name }}</strong>
{{ plugin.get_short_description }}
</span>
</div>
<div class="cms-collapsable-container cms-hidden {% if allow_children %}cms-draggables{% endif %}">
{% if plugin.child_plugin_instances %}
{% for child in plugin.child_plugin_instances %}
{% include cms_toolbar.templates.drag_item_template with plugin=child disabled_child=disable_child_plugins %}{% endfor %}
{% endif %}
</div>
</div>
{% endwith %}

View file

@ -0,0 +1,20 @@
{% load i18n %}
<div class="cms-submenu-item cms-submenu-item-highlight">
<a href="#" data-rel="highlight" data-cms-icon="highlight">
{{ plugin }}{% trans "Highlight" %}
</a>
</div>
{% for item in items %}
<div class="cms-submenu-item">
<a href="{{ item.url }}" data-rel="{{ item.action }}"
{% if item.data %}data-post="{{ item.data }}" {% endif %}
{% if question %}data-text="{{ question }}" {% endif %}
data-on-success="REFRESH_PAGE"
{% for key, attr in item.attributes.items %}
data-{{ key }}="{{ attr }}"
{% endfor %}
>
{{ item.name }}
</a>
</div>
{% endfor %}

View file

@ -0,0 +1,22 @@
{% load i18n %}
{% regroup plugin_menu by module as module_list %}
{% for module in module_list %}
<div class="cms-submenu-item cms-submenu-item-title">
<span>
{% if module.grouper %}
{{ module.grouper|capfirst }}
{% else %}
{% trans "Available plugins" %}
{% endif %}
</span>
</div>
{% for p in module.list %}
{% if p.value != 'AliasPlugin' and p.value != 'PlaceholderPlugin' %}
<div class="cms-submenu-item">
<a data-rel="add" href="{{ p.value }}">
{{ p.name }}
</a>
</div>
{% endif %}
{% endfor %}
{% endfor %}

View file

@ -0,0 +1,3 @@
<li class="cms-toolbar-item-navigation-break">
-----
</li>

View file

@ -0,0 +1,4 @@
<a href="{{ url }}"
class="cms-btn{% if active %}cms-btn-active{% endif %}{% if disabled %}cms-btn-disabled{% endif %}{% if extra_classes %}{{ extra_classes|join:' ' }}{% endif %}">
{{ name }}
</a>

Some files were not shown because too many files have changed in this diff Show more