Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions runtests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! /usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'

COOKIECUTTER_DIR=$1
COOKIECUTTER_ARGS=( "${@:2}" )
TEST_DIR=$(mktemp -d)
cookiecutter --no-input -o "$TEST_DIR" "$COOKIECUTTER_DIR" "${COOKIECUTTER_ARGS[@]}"
pushd "$TEST_DIR/projectname"
tox
popd
rm -rf "$TEST_DIR"
15 changes: 4 additions & 11 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,16 @@ basepython = python3.12
deps =
-rrequirements/testing.txt
changedir = {envtmpdir}
allowlist_externals =
bash
allowlist_externals = {toxinidir}/runtests.sh
passenv =
GDAL_LIBRARY_PATH
GEOS_LIBRARY_PATH

[testenv:django]
commands =
cookiecutter --no-input {toxinidir}
bash -c "cd projectname && tox"
commands = {toxinidir}/runtests.sh {toxinidir}

[testenv:django-multilingual]
commands =
cookiecutter --no-input {toxinidir} multilingual=y
bash -c "cd projectname && tox"
commands = {toxinidir}/runtests.sh {toxinidir} multilingual=y

[testenv:geodjango]
commands =
cookiecutter --no-input {toxinidir} geodjango=y
bash -c "cd projectname && tox"
commands = {toxinidir}/runtests.sh {toxinidir} geodjango=y
4 changes: 0 additions & 4 deletions {{cookiecutter.project_slug}}/project/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@

{%- endif %}

# Allow testing of all styles locally
if settings.DEBUG:
urlpatterns += [path("demo-styles/", TemplateView.as_view(template_name="demo_styles.html"))]

# Make it easier to see a 404 page under debug
if settings.DEBUG:
from django.views.defaults import page_not_found
Expand Down
7 changes: 3 additions & 4 deletions {{cookiecutter.project_slug}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ extend_exclude="field.html"

[tool.djlint.per-file-ignores]
# Disable:
# H006 - Img tag should have height and width attributes
# H025 - Tag seems to be an orphan.
# D018 - Internal links should use the url ... pattern.
# H030 - Consider adding a meta description
# H031 - Consider adding meta keywords
"500.html" = "H030,H031"
"base.html" = "H030,H031"
"demo_styles.html" = "H006"
"tree.html" = "H025"
"includes/footer.html" = "D018"
"includes/header.html" = "D018"

[tool.ruff]
extend-exclude = ["apps/*/migrations"]
Expand Down
21 changes: 14 additions & 7 deletions {{cookiecutter.project_slug}}/templates/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@

{% block main %}
<div class="container">
<h1>{% translate '404 - page not found' %}</h1>

<p>{% translate "We couldn't find the page you are looking for." %}</p>

<p>{% translate 'If you entered the URL manually please check your spelling and try again.' %}</p>

<p><a class="button" href="/">Back to homepage</a></p>
<h1>
{% translate '404 - page not found' %}
</h1>
<p>
{% translate "We couldn't find the page you are looking for." %}
</p>
<p>
{% translate 'If you entered the URL manually please check your spelling and try again.' %}
</p>
<p>
{# djlint:off D018 #}
<a class="button" href="/">Back to homepage</a>
{# djlint:on D018 #}
</p>
</div>
{% endblock main %}
1 change: 0 additions & 1 deletion {{cookiecutter.project_slug}}/templates/500.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<!DOCTYPE html>

{% load i18n %}

<html lang="{{ LANGUAGE_CODE }}"{% if LANGUAGE_BIDI %} dir="rtl"{% endif %}>
Expand Down
24 changes: 10 additions & 14 deletions {{cookiecutter.project_slug}}/templates/base.html
Original file line number Diff line number Diff line change
@@ -1,47 +1,43 @@
<!DOCTYPE html>

{% load i18n %}
{% load static %}

<html lang="{{ LANGUAGE_CODE }}"{% if LANGUAGE_BIDI %} dir="rtl"{% endif %}>
<head>
<title>
{% block title %}{{ request.site.name }}{% endblock %}
{% block title %}
{{ request.site.name }}
{% endblock title %}
</title>
<link rel="stylesheet" href="{% static 'dist/css/styles.css' %}">
<link rel="stylesheet" href="{% static 'dist/css/styles.css' %}" />
<link rel="canonical" href="{{ request.build_absolute_uri }}" />

{% include 'includes/meta.html' %}

{% if BROWSERSYNC_URL %}
<script src="{{ BROWSERSYNC_URL }}" async></script>
{% endif %}
</head>

<body>
{% if DEMO_SITE %}
<div class="demo-announcement">
<div class="container">{% translate 'This site is in development. Any changes made here will not be transferred to the production build.' %}</div>
<div class="container">
{% translate 'This site is in development. Any changes made here will not be transferred to the production build.' %}
</div>
</div>
{% endif %}

<header class="header">
{% include 'includes/header.html' %}
</header>

<main class="main">
{% block main %}
<div id="app"></div>
{% endblock %}
<div id="app">
</div>
{% endblock main %}
</main>

<footer class="footer inverted">
{% include 'includes/footer.html' %}
</footer>

<script src="{% static 'dist/js/app.js' %}"></script>
<script src="{% static 'dist/js/base.js' %}"></script>

{% block extra_scripts %}
{% endblock extra_scripts %}
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@
{% load l10n %}

{% include 'bootstrap/layout/field_errors_block.html' %}

{% for choice in field.field.choices %}
<div class="checkbox">
<input type="checkbox"{% if choice.0 in field.value or choice.0|stringformat:"s" in field.value or choice.0|stringformat:"s" == field.value|default_if_none:""|stringformat:"s" %} checked="checked"{% endif %} name="{{ field.html_name }}" id="id_{{ field.html_name }}_{{ forloop.counter }}" class="checkboxinput" value="{{ choice.0|unlocalize }}" {{ field.field.widget.attrs|flatatt }}>
<label class="checkbox-label{% if inline_class %} {{ inline_class }}{% endif %}" for="id_{{ field.html_name }}_{{ forloop.counter }}">{{ choice.1|unlocalize }}</label>
</div>
{% endfor %}

<div class="checkbox-options">
{% for choice in field.field.choices %}
<div class="checkbox">
{# djlint:off #}
<input
type="checkbox"
{% if choice.0 in field.value or choice.0|stringformat:"s" in field.value or choice.0|stringformat:"s" == field.value|default_if_none:""|stringformat:"s" %}checked="checked"{% endif %}
name="{{ field.html_name }}"
id="id_{{ field.html_name }}_{{ forloop.counter }}"
class="checkboxinput" value="{{ choice.0|unlocalize }}"
{{ field.field.widget.attrs|flatatt }} />
{# djlint:on #}
<label class="checkbox-label{% if inline_class %} {{ inline_class }}{% endif %}"
for="id_{{ field.html_name }}_{{ forloop.counter }}">
<span class="checkbox-status"></span>{{ choice.1|unlocalize }}
</label>
</div>
{% endfor %}
</div>
{% include 'bootstrap/layout/help_text_and_errors.html' %}
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
{% load crispy_forms_filters %}
{% load l10n %}

{% include 'bootstrap/layout/field_errors_block.html' %}

{% for choice in field.field.choices %}
<div class="radio">
<input type="radio"{% if choice.0|stringformat:"s" == field.value|default_if_none:""|stringformat:"s" %} checked="checked"{% endif %} name="{{ field.html_name }}" id="id_{{ field.id_for_label }}_{{ forloop.counter }}" class="radioinput" value="{{ choice.0|unlocalize }}" {{ field.field.widget.attrs|flatatt }}>
<label for="id_{{ field.id_for_label }}_{{ forloop.counter }}" class="radio-label{% if inline_class %} {{ inline_class }}{% endif %}">{{ choice.1|unlocalize }}</label>
</div>
{% endfor %}

{% include 'bootstrap/layout/help_text_and_errors.html' %}
<div class="radio-options">
{% for choice in field.field.choices %}
<div class="radio">
{# djlint:off #}
<input type="radio"
{% if choice.0|stringformat:"s" == field.value|default_if_none:""|stringformat:"s" %} checked="checked"{% endif %}
name="{{ field.html_name }}"
id="id_{{ field.html_name }}_{{ forloop.counter }}"
class="radioinput"
value="{{ choice.0|unlocalize }}"
{{ field.field.widget.attrs|flatatt }} />
{# djlint:on #}
<label for="id_{{ field.html_name }}_{{ forloop.counter }}"
class="radio-label{% if inline_class %} {{ inline_class }}{% endif %}">
<span class="radio-status"></span>
{{ choice.1|unlocalize }}
</label>
</div>
{% endfor %}
</div>
Loading