Add and apply djlint

This commit is contained in:
Adam Goldsmith 2022-01-23 23:03:08 -05:00
parent cc18c78235
commit 1577cb7654
10 changed files with 285 additions and 104 deletions

View File

@ -14,6 +14,7 @@ mysqlclient = "~=2.1"
django-recurrence = "~=1.10" django-recurrence = "~=1.10"
[dev-packages] [dev-packages]
djlint = "~=0.7"
[requires] [requires]
python_version = "3.9" python_version = "3.9"

170
Pipfile.lock generated
View File

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "9cf17685e17165c0233b4baad34b69120522ea8960d7c36247e084fa8c70a7e8" "sha256": "38925606631e4d558d3539d27170aaaa686a4dc20fe8ee68f435b93c3ef7c12f"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
@ -275,5 +275,171 @@
"version": "==3.7.0" "version": "==3.7.0"
} }
}, },
"develop": {} "develop": {
"click": {
"hashes": [
"sha256:353f466495adaeb40b6b5f592f9f91cb22372351c84caeb068132442a4518ef3",
"sha256:410e932b050f5eed773c4cda94de75971c89cdb3155a72a0831139a79e5ecb5b"
],
"markers": "python_version >= '3.6'",
"version": "==8.0.3"
},
"colorama": {
"hashes": [
"sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b",
"sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
"version": "==0.4.4"
},
"djlint": {
"hashes": [
"sha256:95715103781a4258ef91bdcb3702e1f5707ca075ceb49b58f0a8ce6b568115c6",
"sha256:d03cc3d6cd51db9f942211ffbdc85009d33f31e28ea1edbd22954af80d28141a"
],
"index": "pypi",
"version": "==0.7.2"
},
"pathspec": {
"hashes": [
"sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a",
"sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"
],
"version": "==0.9.0"
},
"pyyaml": {
"hashes": [
"sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293",
"sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b",
"sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57",
"sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b",
"sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4",
"sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07",
"sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba",
"sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9",
"sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287",
"sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513",
"sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0",
"sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0",
"sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92",
"sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f",
"sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2",
"sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc",
"sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c",
"sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86",
"sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4",
"sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c",
"sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34",
"sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b",
"sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c",
"sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb",
"sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737",
"sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3",
"sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d",
"sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53",
"sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78",
"sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803",
"sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a",
"sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174",
"sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5"
],
"markers": "python_version >= '3.6'",
"version": "==6.0"
},
"regex": {
"hashes": [
"sha256:0416f7399e918c4b0e074a0f66e5191077ee2ca32a0f99d4c187a62beb47aa05",
"sha256:05b7d6d7e64efe309972adab77fc2af8907bb93217ec60aa9fe12a0dad35874f",
"sha256:0617383e2fe465732af4509e61648b77cbe3aee68b6ac8c0b6fe934db90be5cc",
"sha256:07856afef5ffcc052e7eccf3213317fbb94e4a5cd8177a2caa69c980657b3cb4",
"sha256:0f594b96fe2e0821d026365f72ac7b4f0b487487fb3d4aaf10dd9d97d88a9737",
"sha256:139a23d1f5d30db2cc6c7fd9c6d6497872a672db22c4ae1910be22d4f4b2068a",
"sha256:162abfd74e88001d20cb73ceaffbfe601469923e875caf9118333b1a4aaafdc4",
"sha256:2207ae4f64ad3af399e2d30dde66f0b36ae5c3129b52885f1bffc2f05ec505c8",
"sha256:2409b5c9cef7054dde93a9803156b411b677affc84fca69e908b1cb2c540025d",
"sha256:2fee3ed82a011184807d2127f1733b4f6b2ff6ec7151d83ef3477f3b96a13d03",
"sha256:30ab804ea73972049b7a2a5c62d97687d69b5a60a67adca07eb73a0ddbc9e29f",
"sha256:3598893bde43091ee5ca0a6ad20f08a0435e93a69255eeb5f81b85e81e329264",
"sha256:3b5df18db1fccd66de15aa59c41e4f853b5df7550723d26aa6cb7f40e5d9da5a",
"sha256:3c5fb32cc6077abad3bbf0323067636d93307c9fa93e072771cf9a64d1c0f3ef",
"sha256:416c5f1a188c91e3eb41e9c8787288e707f7d2ebe66e0a6563af280d9b68478f",
"sha256:42b50fa6666b0d50c30a990527127334d6b96dd969011e843e726a64011485da",
"sha256:432bd15d40ed835a51617521d60d0125867f7b88acf653e4ed994a1f8e4995dc",
"sha256:473e67837f786404570eae33c3b64a4b9635ae9f00145250851a1292f484c063",
"sha256:4aaa4e0705ef2b73dd8e36eeb4c868f80f8393f5f4d855e94025ce7ad8525f50",
"sha256:50a7ddf3d131dc5633dccdb51417e2d1910d25cbcf842115a3a5893509140a3a",
"sha256:529801a0d58809b60b3531ee804d3e3be4b412c94b5d267daa3de7fadef00f49",
"sha256:537ca6a3586931b16a85ac38c08cc48f10fc870a5b25e51794c74df843e9966d",
"sha256:53db2c6be8a2710b359bfd3d3aa17ba38f8aa72a82309a12ae99d3c0c3dcd74d",
"sha256:5537f71b6d646f7f5f340562ec4c77b6e1c915f8baae822ea0b7e46c1f09b733",
"sha256:563d5f9354e15e048465061509403f68424fef37d5add3064038c2511c8f5e00",
"sha256:5d408a642a5484b9b4d11dea15a489ea0928c7e410c7525cd892f4d04f2f617b",
"sha256:61600a7ca4bcf78a96a68a27c2ae9389763b5b94b63943d5158f2a377e09d29a",
"sha256:6650f16365f1924d6014d2ea770bde8555b4a39dc9576abb95e3cd1ff0263b36",
"sha256:666abff54e474d28ff42756d94544cdfd42e2ee97065857413b72e8a2d6a6345",
"sha256:68a067c11463de2a37157930d8b153005085e42bcb7ad9ca562d77ba7d1404e0",
"sha256:6e1d2cc79e8dae442b3fa4a26c5794428b98f81389af90623ffcc650ce9f6732",
"sha256:74cbeac0451f27d4f50e6e8a8f3a52ca074b5e2da9f7b505c4201a57a8ed6286",
"sha256:780b48456a0f0ba4d390e8b5f7c661fdd218934388cde1a974010a965e200e12",
"sha256:788aef3549f1924d5c38263104dae7395bf020a42776d5ec5ea2b0d3d85d6646",
"sha256:7ee1227cf08b6716c85504aebc49ac827eb88fcc6e51564f010f11a406c0a667",
"sha256:7f301b11b9d214f83ddaf689181051e7f48905568b0c7017c04c06dfd065e244",
"sha256:83ee89483672b11f8952b158640d0c0ff02dc43d9cb1b70c1564b49abe92ce29",
"sha256:85bfa6a5413be0ee6c5c4a663668a2cad2cbecdee367630d097d7823041bdeec",
"sha256:9345b6f7ee578bad8e475129ed40123d265464c4cfead6c261fd60fc9de00bcf",
"sha256:93a5051fcf5fad72de73b96f07d30bc29665697fb8ecdfbc474f3452c78adcf4",
"sha256:962b9a917dd7ceacbe5cd424556914cb0d636001e393b43dc886ba31d2a1e449",
"sha256:96fc32c16ea6d60d3ca7f63397bff5c75c5a562f7db6dec7d412f7c4d2e78ec0",
"sha256:98ba568e8ae26beb726aeea2273053c717641933836568c2a0278a84987b2a1a",
"sha256:a3feefd5e95871872673b08636f96b61ebef62971eab044f5124fb4dea39919d",
"sha256:a955b747d620a50408b7fdf948e04359d6e762ff8a85f5775d907ceced715129",
"sha256:b43c2b8a330a490daaef5a47ab114935002b13b3f9dc5da56d5322ff218eeadb",
"sha256:b483c9d00a565633c87abd0aaf27eb5016de23fed952e054ecc19ce32f6a9e7e",
"sha256:b9ed0b1e5e0759d6b7f8e2f143894b2a7f3edd313f38cf44e1e15d360e11749b",
"sha256:ba05430e819e58544e840a68b03b28b6d328aff2e41579037e8bab7653b37d83",
"sha256:ca49e1ab99593438b204e00f3970e7a5f70d045267051dfa6b5f4304fcfa1dbf",
"sha256:ca5f18a75e1256ce07494e245cdb146f5a9267d3c702ebf9b65c7f8bd843431e",
"sha256:cd410a1cbb2d297c67d8521759ab2ee3f1d66206d2e4328502a487589a2cb21b",
"sha256:ce298e3d0c65bd03fa65ffcc6db0e2b578e8f626d468db64fdf8457731052942",
"sha256:d5ca078bb666c4a9d1287a379fe617a6dccd18c3e8a7e6c7e1eb8974330c626a",
"sha256:d5fd67df77bab0d3f4ea1d7afca9ef15c2ee35dfb348c7b57ffb9782a6e4db6e",
"sha256:da1a90c1ddb7531b1d5ff1e171b4ee61f6345119be7351104b67ff413843fe94",
"sha256:dba70f30fd81f8ce6d32ddeef37d91c8948e5d5a4c63242d16a2b2df8143aafc",
"sha256:dc07f021ee80510f3cd3af2cad5b6a3b3a10b057521d9e6aaeb621730d320c5a",
"sha256:dd33eb9bdcfbabab3459c9ee651d94c842bc8a05fabc95edf4ee0c15a072495e",
"sha256:e0538c43565ee6e703d3a7c3bdfe4037a5209250e8502c98f20fea6f5fdf2965",
"sha256:e1f54b9b4b6c53369f40028d2dd07a8c374583417ee6ec0ea304e710a20f80a0",
"sha256:e32d2a2b02ccbef10145df9135751abea1f9f076e67a4e261b05f24b94219e36",
"sha256:e6096b0688e6e14af6a1b10eaad86b4ff17935c49aa774eac7c95a57a4e8c296",
"sha256:e71255ba42567d34a13c03968736c5d39bb4a97ce98188fafb27ce981115beec",
"sha256:ed2e07c6a26ed4bea91b897ee2b0835c21716d9a469a96c3e878dc5f8c55bb23",
"sha256:eef2afb0fd1747f33f1ee3e209bce1ed582d1896b240ccc5e2697e3275f037c7",
"sha256:f23222527b307970e383433daec128d769ff778d9b29343fb3496472dc20dabe",
"sha256:f341ee2df0999bfdf7a95e448075effe0db212a59387de1a70690e4acb03d4c6",
"sha256:f5be7805e53dafe94d295399cfbe5227f39995a997f4fd8539bf3cbdc8f47ca8",
"sha256:f7f325be2804246a75a4f45c72d4ce80d2443ab815063cdf70ee8fb2ca59ee1b",
"sha256:f8af619e3be812a2059b212064ea7a640aff0568d972cd1b9e920837469eb3cb",
"sha256:fa8c626d6441e2d04b6ee703ef2d1e17608ad44c7cb75258c09dd42bacdfc64b",
"sha256:fbb9dc00e39f3e6c0ef48edee202f9520dafb233e8b51b06b8428cfcb92abd30",
"sha256:fff55f3ce50a3ff63ec8e2a8d3dd924f1941b250b0aac3d3d42b687eeff07a8e"
],
"version": "==2021.11.10"
},
"tomlkit": {
"hashes": [
"sha256:173ad840fa5d2aac140528ca1933c29791b79a374a0861a80347f42ec9328117",
"sha256:d7a454f319a7e9bd2e249f239168729327e4dd2d27b17dc68be264ad1ce36754"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
"version": "==0.7.2"
},
"tqdm": {
"hashes": [
"sha256:8dd278a422499cd6b727e6ae4061c40b48fce8b76d1ccbf5d34fca9b7f925b0c",
"sha256:d359de7217506c9851b7869f3708d8ee53ed70a1b8edbba4dbcb47442592920d"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==4.62.3"
}
}
} }

7
pyproject.toml Normal file
View File

@ -0,0 +1,7 @@
[tool.black]
extend-exclude = "/migrations/.*.py"
[tool.djlint]
extension = ".dj.html"
indent = 2
blank_line_after_tag = "load,extends"

View File

@ -1,8 +1,6 @@
<li> <li>
<a href="{{ task.get_absolute_url }}"> <a href="{{ task.get_absolute_url }}">{{ task.name }}</a>
{{ task.name }} - last completed {{ task.last_event.date|date|default:"never" }}
</a>
- last completed {{ task.last_event.date|date|default:"never"}}
({{ task.last_event.date|timesince|default:"never" }}), ({{ task.last_event.date|timesince|default:"never" }}),
next required {{ task.next_recurrence|date|default:"never" }} ({{ task.next_recurrence|timeuntil|default:"never" }}) next required {{ task.next_recurrence|date|default:"never" }} ({{ task.next_recurrence|timeuntil|default:"never" }})
</li> </li>

View File

@ -1,21 +1,24 @@
{% extends "base.dj.html" %} {% extends "base.dj.html" %}
{% block content %} {% block content %}
<h1> Tools </h1> <h1>Tools</h1>
<ul> <ul>
{% for tool in tools %} {% for tool in tools %}
{% include "./components/tool_li.dj.html" with tool=tool %} {% include "./components/tool_li.dj.html" with tool=tool %}
{% empty %} {% empty %}
<p>No tools are available.</p> <p>
No tools are available.
</p>
{% endfor %} {% endfor %}
</ul> </ul>
<h1>Tasks</h1>
<h1> Tasks </h1>
<ul> <ul>
{% for task in tasks %} {% for task in tasks %}
{% include "./components/task_li.dj.html" with task=task %} {% include "./components/task_li.dj.html" with task=task %}
{% empty %} {% empty %}
<p>No tasks are available.</p> <p>
No tasks are available.
</p>
{% endfor %} {% endfor %}
</ul> </ul>
{% endblock %} {% endblock %}

View File

@ -3,29 +3,30 @@
{% load markdownify %} {% load markdownify %}
{% load widget_tweaks %} {% load widget_tweaks %}
{% block title %} {{ tool.name }} - {{ task.name }} | {{ block.super }} {% endblock %} {% block title %}{{ tool.name }} - {{ task.name }} | {{ block.super }}{% endblock %}
{% block admin_link %}
{% block admin_link %}{% url 'admin:tasks_task_change' task.id %}{% endblock %} {% url 'admin:tasks_task_change' task.id %}
{% endblock %}
{% block nav_extra %} {% block nav_extra %}
{% if user.is_authenticated %} {% if user.is_authenticated %}
{% if task_subs or tool_subs %} {% if task_subs or tool_subs %}
<span class="nav-item dropdown"> <span class="nav-item dropdown">
<button class="btn nav-link dropdown-toggle" <button class="btn nav-link dropdown-toggle"
data-bs-toggle="dropdown" data-bs-toggle="dropdown"
aria-expanded="false"> aria-expanded="false">🔔</button>
🔔
</button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><h6 class="dropdown-header">Group Task Subscriptions</h6></li> <li>
<h6 class="dropdown-header">Group Task Subscriptions</h6>
</li>
{% for task_sub in task_subs %} {% for task_sub in task_subs %}
<li class="dropdown-item disabled text-reset"> <li class="dropdown-item disabled text-reset">{{ task_sub.group }} - {{ task_sub.days_before }} days</li>
{{ task_sub.group }} - {{ task_sub.days_before }} days
</li>
{% endfor %} {% endfor %}
<li><hr class="dropdown-divider"></li> <li>
<hr class="dropdown-divider">
<li><h6 class="dropdown-header">Group Tool Subscriptions</h6></li> </li>
<li>
<h6 class="dropdown-header">Group Tool Subscriptions</h6>
</li>
{% for tool_sub in tool_subs %} {% for tool_sub in tool_subs %}
<li class="dropdown-item disabled text-reset"> <li class="dropdown-item disabled text-reset">
{{ tool_sub.tool }} - {{ tool_sub.group }} - {{ tool_sub.days_before }} days {{ tool_sub.tool }} - {{ tool_sub.group }} - {{ tool_sub.days_before }} days
@ -38,47 +39,41 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<nav aria-label="breadcrumb"> <nav aria-label="breadcrumb">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">Home</a></li> <li class="breadcrumb-item">
<li class="breadcrumb-item"><a href="{{ tool.get_absolute_url }}">{{ tool.name }}</a></li> <a href="/">Home</a>
</li>
<li class="breadcrumb-item">
<a href="{{ tool.get_absolute_url }}">{{ tool.name }}</a>
</li>
<li class="breadcrumb-item active" aria-current="page">{{ task.name }}</li> <li class="breadcrumb-item active" aria-current="page">{{ task.name }}</li>
</ol> </ol>
</nav> </nav>
<section> <section>
<h2> Recurrence </h2> <h2>Recurrence</h2>
<ul> <ul>
{% for rule in task.recurrence.rrules %} {% for rule in task.recurrence.rrules %}<li>{{ rule.to_text }}</li>{% endfor %}
<li> {{ rule.to_text }} </li>
{% endfor %}
</ul> </ul>
<p>
<p> Next scheduled time: {{ task.next_recurrence|date|default:"never" }} </p> Next scheduled time: {{ task.next_recurrence|date|default:"never" }}
{% if task.is_overdue %} </p>
<div class="alert alert-danger"> {% if task.is_overdue %}<div class="alert alert-danger">Task is overdue!</div>{% endif %}
Task is overdue!
</div>
{% endif %}
</section> </section>
<section> <section>
<h2> Description </h2> <h2>Description</h2>
{{ task.description|markdownify }} {{ task.description|markdownify }}
</section> </section>
{% if form.errors %} {% if form.errors %}
<div class="alert alert-warning"> <div class="alert alert-warning">
<h3> Error: </h3> <h3>Error:</h3>
{{ form.errors }} {{ form.errors }}
</div> </div>
{% endif %} {% endif %}
{% if user.is_authenticated %} {% if user.is_authenticated %}
<div class="d-md-none"> <div class="d-md-none">
<h2> Log a Maintenance Event </h2> <h2>Log a Maintenance Event</h2>
<form class="form-group" method="post"> <form class="form-group" method="post">
{% csrf_token %} {% csrf_token %}
<fieldset class="form-group"> <fieldset class="form-group">
@ -95,18 +90,16 @@
</fieldset> </fieldset>
<input type="submit" class="btn btn-primary" value="Submit"> <input type="submit" class="btn btn-primary" value="Submit">
</form> </form>
{{ form.media }} {{ form.media }}
</div> </div>
{% endif %} {% endif %}
<h2>Event Log</h2>
<h2> Event Log </h2>
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead> <thead>
<tr> <tr>
<th> Date </th> <th>Date</th>
<th> User </th> <th>User</th>
<th> Notes </th> <th>Notes</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -114,18 +107,20 @@
<tr class="d-none d-md-table-row"> <tr class="d-none d-md-table-row">
<form method="post"> <form method="post">
{% csrf_token %} {% csrf_token %}
<td> {% render_field form.date type="date" class="form-control" %} </td> <td>{% render_field form.date type="date" class="form-control" %}</td>
<td> {% render_field form.user class="form-control" style="width: initial;" %} </td> <td>{% render_field form.user class="form-control" style="width: initial;" %}</td>
<td> {% render_field form.notes class="form-control form-control-sm" %} </td> <td>{% render_field form.notes class="form-control form-control-sm" %}</td>
<td> <input type="submit" class="btn btn-primary" value="Submit"> </td> <td>
<input type="submit" class="btn btn-primary" value="Submit">
</td>
</form> </form>
</tr> </tr>
{% endif %} {% endif %}
{% for event in events|dictsortreversed:"date" %} {% for event in events|dictsortreversed:"date" %}
<tr> <tr>
<td class="text-nowrap"> {{ event.date }} </td> <td class="text-nowrap">{{ event.date }}</td>
<td> {{ event.user }} </td> <td>{{ event.user }}</td>
<td> {{ event.notes|markdownify }} </td> <td>{{ event.notes|markdownify }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>

View File

@ -2,18 +2,19 @@
{% load markdownify %} {% load markdownify %}
{% block title %} {{ tool }} | {{ block.super }} {% endblock %} {% block title %}{{ tool }} | {{ block.super }}{% endblock %}
{% block admin_link %}
{% block admin_link %}{% url 'admin:tasks_tool_change' tool.id %}{% endblock %} {% url 'admin:tasks_tool_change' tool.id %}
{% endblock %}
{% block content %} {% block content %}
<nav aria-label="breadcrumb"> <nav aria-label="breadcrumb">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">Home</a></li> <li class="breadcrumb-item">
<a href="/">Home</a>
</li>
<li class="breadcrumb-item active" aria-current="page">{{ tool }}</li> <li class="breadcrumb-item active" aria-current="page">{{ tool }}</li>
</ol> </ol>
</nav> </nav>
<section> <section>
<h2>Tasks</h2> <h2>Tasks</h2>
<ul> <ul>
@ -22,25 +23,24 @@
{% endfor %} {% endfor %}
</ul> </ul>
</section> </section>
<section> <section>
<h2>Event Log</h2> <h2>Event Log</h2>
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead> <thead>
<tr> <tr>
<th> Date </th> <th>Date</th>
<th> Task </th> <th>Task</th>
<th> User </th> <th>User</th>
<th> Notes </th> <th>Notes</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for event in events|dictsortreversed:"date" %} {% for event in events|dictsortreversed:"date" %}
<tr> <tr>
<td class="text-nowrap"> {{ event.date }} </td> <td class="text-nowrap">{{ event.date }}</td>
<td> {{ event.task.name }} </td> <td>{{ event.task.name }}</td>
<td> {{ event.user }} </td> <td>{{ event.user }}</td>
<td> {{ event.notes|markdownify }} </td> <td>{{ event.notes|markdownify }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>

View File

@ -2,13 +2,13 @@
{% load widget_tweaks %} {% load widget_tweaks %}
{% block title %} Login {% endblock %} {% block title %}Login{% endblock %}
{% block content %} {% block content %}
{% if form.errors %} {% if form.errors %}
<p class="alert alert-danger">Your username and password didn't match. Please try again.</p> <p class="alert alert-danger">
Your username and password didn't match. Please try again.
</p>
{% endif %} {% endif %}
{% if next %} {% if next %}
{% if user.is_authenticated %} {% if user.is_authenticated %}
<p class="alert alert-danger"> <p class="alert alert-danger">
@ -16,22 +16,22 @@
please login with an account that has access. please login with an account that has access.
</p> </p>
{% else %} {% else %}
<p class="alert alert-info">Please login to see this page.</p> <p class="alert alert-info">
Please login to see this page.
</p>
{% endif %} {% endif %}
{% endif %} {% endif %}
<form class="d-flex flex-column align-items-center"
<form class="d-flex flex-column align-items-center" method="post" action="{% url 'login' %}"> method="post"
action="{% url 'login' %}">
{% csrf_token %} {% csrf_token %}
{% for field in form %} {% for field in form %}
<div class="form-group row"> <div class="form-group row">
<label class="col-sm-4 col-form-label" for="{{ field.auto_id }}">{{ field.label }}</label> <label class="col-sm-4 col-form-label" for="{{ field.auto_id }}">{{ field.label }}</label>
<div class="col-sm-8"> <div class="col-sm-8">{% render_field field class="form-control" %}</div>
{% render_field field class="form-control" %}
</div> </div>
</div>
{% endfor %} {% endfor %}
<input type="submit" class="btn btn-primary" value="login" /> <input type="submit" class="btn btn-primary" value="login" />
<input type="hidden" name="next" value="{{ next }}" /> <input type="hidden" name="next" value="{{ next }}" />
</form> </form>
{% endblock %} {% endblock %}

View File

@ -1,10 +1,11 @@
{% extends "base.dj.html" %} {% extends "base.dj.html" %}
{% block title %} Logout {% endblock %} {% block title %}Logout{% endblock %}
{% block content %} {% block content %}
<div class="d-flex flex-column align-items-center p-4"> <div class="d-flex flex-column align-items-center p-4">
<p>Logged out!</p> <p>
<a href="{% url 'login'%}">Click here to login again.</a> Logged out!
</p>
<a href="{% url 'login' %}">Click here to login again.</a>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -2,42 +2,52 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS --> <!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css"
rel="stylesheet"
<title>{% block title %}RecMaint{% endblock %}</title> integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x"
crossorigin="anonymous">
<title>
{% block title %}RecMaint{% endblock %}
</title>
</head> </head>
<body> <body>
<nav class="navbar navbar-expand-lg navbar-light bg-light"> <nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand" href="/">RecMaint</a> <a class="navbar-brand" href="/">RecMaint</a>
<button class="navbar-toggler"
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#user-nav" aria-controls="user-nav" aria-expanded="false" aria-label="Toggle navigation"> type="button"
data-toggle="collapse"
data-target="#user-nav"
aria-controls="user-nav"
aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
<div id="user-nav" class="collapse navbar-collapse justify-content-end"> <div id="user-nav" class="collapse navbar-collapse justify-content-end">
<div class="navbar-nav"> <div class="navbar-nav">
{% block nav_extra %}{% endblock %} {% block nav_extra %}{% endblock %}
{% if user.is_staff %} {% if user.is_staff %}
<a class="nav-item nav-link" href="{% block admin_link %}/admin{% endblock %}"> Admin </a> <a class="nav-item nav-link"
href="{% block admin_link %}/admin{% endblock %}">Admin</a>
{% endif %} {% endif %}
{% if user.is_authenticated %} {% if user.is_authenticated %}
<a class="nav-item nav-link" href="/auth/logout"> Logout: {{ user }} </a> <a class="nav-item nav-link" href="/auth/logout">Logout: {{ user }}</a>
{% else %} {% else %}
<a class="nav-item nav-link" href="/auth/login?next={{ request.get_full_path }}"> Login </a> <a class="nav-item nav-link"
href="/auth/login?next={{ request.get_full_path }}">Login</a>
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div> </div>
</nav> </nav>
<div id="content" class="m-3"> <div id="content" class="m-3">
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>
<!-- Bootstrap JS --> <!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous">
</script>
</body> </body>
</html> </html>