1
0
Fork 0
mirror of https://github.com/Findus23/RPGnotes.git synced 2024-09-19 15:43:45 +02:00

migrate everything over to jinja2

This commit is contained in:
Lukas Winkler 2021-10-15 21:47:49 +02:00
parent 46dc3492ad
commit b5c5366608
Signed by: lukas
GPG key ID: 54DE4D798D244853
51 changed files with 373 additions and 532 deletions

View file

@ -70,7 +70,7 @@ class CampaignDeleteView(generic.DeleteView):
"""
broken at the moment
"""
template_name = "common/confirm_delete.html"
template_name = "common/confirm_delete.jinja"
model = Campaign
slug_url_kwarg = "campslug"
success_url = reverse_lazy('campaigndetail')

View file

@ -1,16 +1,17 @@
{% extends "tenantbase.jinja" %}
{% import "macros.jinja" as macros %}
{% block content %}
<div class="row">
<div class="col-4">
<ul class="nav nav-pills flex-column">
{% for c in player_characters %}
{# {% include "macros/character-pillar.html" with character=c %}#}
{{ macros.character_pillar(c) }}
{% endfor %}
</ul>
<ul class="nav nav-pills flex-column">
{% for c in npcs %}
{# {% include "macros/character-pillar.html" with character=c %}#}
{{ macros.character_pillar(c) }}
{% endfor %}
</ul>
<a class="btn btn-primary" href="{{ url("characteradd") }}">{% trans %}Add Character{% endtrans %}</a>
@ -18,14 +19,13 @@
<div class="col-8">
<div class="character-heading" style="border-bottom-color: {{ character.color }}">
{% if character.smaller_image %}
{# {% thumbnail character.smaller_image "150x150" crop="center" as im %}#}
{# <a href="{{ character.smaller_image.url }}" class="image-viewer">#}
{# <img class="avatar avatar-image avatar-large rounded-circle" src="{{ im.url }}"#}
{# width="{{ im.width }}"#}
{# height="{{ im.height }}"#}
{# srcset="{{ im.url|srcset }}">#}
{# </a>#}
{# {% endthumbnail %}#}
{% set im=thumbnail(character.smaller_image, "150x150", crop="center") %}
<a href="{{ character.smaller_image.url }}" class="image-viewer">
<img class="avatar avatar-image avatar-large rounded-circle" src="{{ im.url }}"
width="{{ im.width }}"
height="{{ im.height }}"
srcset="{{ im.url|srcset }}">
</a>
{% else %}
<div class="avatar avatar-text avatar-large"
style="background: {{ character.color }};color:{{ character.text_color }}">{{ character.initials }}</div>
@ -47,7 +47,7 @@
{% endif %}
{% if character.faction %}
<dt>{{ _("Faction") }}:</dt>
<dd><a href="{{ character.faction.get_absolute_url }}">{{ character.faction.name }}</a></dd>
<dd><a href="{{ character.faction.get_absolute_url() }}">{{ character.faction.name }}</a></dd>
{% endif %}
</dl>
{{ character.description_html|safe }}

View file

@ -30,14 +30,14 @@ class CharacterDetailView(generic.DetailView):
class CharacterCreateView(generic.CreateView):
template_name = "loot/edit.html"
template_name = "loot/edit.jinja"
model = Character
form_class = CharacterForm
context_object_name = "object"
class CharacterEditView(generic.UpdateView):
template_name = "loot/edit.html"
template_name = "loot/edit.jinja"
model = Character
form_class = CharacterForm
@ -48,6 +48,6 @@ class CharacterEditView(generic.UpdateView):
class CharacterDeleteView(generic.DeleteView):
template_name = "common/confirm_delete.html"
template_name = "common/confirm_delete.jinja"
model = Character
success_url = reverse_lazy('characterlist')

View file

@ -1,16 +1,14 @@
from django import template
from django.template.defaultfilters import safe
from django_jinja import library
from utils.money import format_money as money_formatter
register = template.Library()
@register.filter()
@library.filter()
def format_money(money):
return money_formatter(money)
@register.filter()
@library.filter()
def format_money_html(money):
return safe(money_formatter(money, html=True))

View file

@ -0,0 +1,14 @@
from django.utils import translation
from django_jinja import library
from rpg_notes.settings import LANGUAGES
@library.global_function()
def language_code():
return translation.get_language()
@library.global_function()
def all_languages():
return LANGUAGES

View file

@ -1,11 +1,9 @@
from django import template
from sorl.thumbnail.templatetags.thumbnail import resolution
from django_jinja import library
from sorl.thumbnail import get_thumbnail
from sorl.thumbnail.templatetags.thumbnail import resolution
from rpg_notes import settings
register = template.Library()
@library.global_function
def thumbnail(*args, **kwargs):

View file

@ -1,11 +1,9 @@
from django import template
from django_jinja import library
from rpg_notes.settings import DEBUG, DOMAIN
register = template.Library()
@register.simple_tag
@library.global_function
def main_url():
protocol = "http" if DEBUG else "https"
return f"{protocol}://{DOMAIN}"

View file

@ -1,12 +1,12 @@
from functools import lru_cache
from subprocess import run
from django import template
from django.core.cache import cache
register = template.Library()
from django_jinja import library
@register.simple_tag
@library.global_function
@lru_cache(maxsize=None)
def commit_id():
commit = cache.get("commit")
if not commit:

View file

@ -1,6 +1,7 @@
from django.http import HttpResponse
from django.shortcuts import render
from django.views.generic import TemplateView
from django_jinja.views import ServerError
from ipware import get_client_ip
from sentry_sdk import last_event_id
@ -13,7 +14,7 @@ class PublicHomepageView(TemplateView):
class LanguageSelectView(TemplateView):
template_name = "common/languageselect.html"
template_name = "common/languageselect.jinja"
def print_ip(request):
@ -32,9 +33,8 @@ def debug_css_sourcemap(request):
css, source_map = get_css(debug=True)
return HttpResponse(source_map, content_type="application/json")
def handler500(request, *args, **argv):
return render(request, "500.html", {
return render(request, "500.jinja", {
"sentry_event_id": last_event_id(),
"sentry_dsn": SENTRY_DSN
}, status=500)

View file

@ -1,6 +1,5 @@
{% extends "tenantbase.html" %}
{% load i18n %}
{% load humanize %}
{% extends "tenantbase.jinja" %}
{% import "macros.jinja" as macros %}
{% block content %}
<div class="row">
@ -8,34 +7,31 @@
<ul class="nav nav-pills flex-column">
{% for d in days %}
<li class="nav-item">
<a href="{% url "daydetail" d.day %}"
<a href="{{ url("daydetail", d.day) }}"
class="nav-link {% if d.id == day.id %}active{% endif %}">
{{ d.prettyname }}
</a>
</li>
{% endfor %}
</ul>
<a class="btn btn-primary add-button" href="{% url "dayadd" %}">{% translate "Add Day" %}</a>
<a class="btn btn-primary add-button" href="{{ url("dayadd") }} ">{{ _("Add Day") }}</a>
</div>
<div class="col-8">
<div class="day-heading">
<h1>
{{ day.prettyname }}
<a href="{% url "dayedit" day.day %}">
{% translate "Edit" %}
<a href="{{ url("daydetail", day.day) }}">
{{ _("Edit") }}
</a>
</h1>
</div>
{{ day.description_html|safe }}
<dl>
<dt>{% translate "Sessions" %}:</dt>
<dd>{{ day.sessions.all|join:", " }}</dd>
<dt>{{ _("Sessions") }}:</dt>
<dd>{{ day.sessions.all()|join(", ") }}</dd>
</dl>
<div>
<small>{% translate "Last updated" %}: {{ day.last_modified|naturaltime }}
{% translate "by" %} {{ day.history.first.history_user }} </small>
</div>
{{ macros.last_edited(day) }}
</div>
</div>
{% endblock %}

View file

@ -14,7 +14,7 @@ def list_day_redirect(request, *args, **kwargs):
class DayDetailView(generic.DetailView):
template_name = "days/day_detail.html"
template_name = "days/day_detail.jinja"
model = IngameDay
context_object_name = "day"
@ -28,14 +28,14 @@ class DayDetailView(generic.DetailView):
class DayCreateView(generic.CreateView):
template_name = "loot/edit.html"
template_name = "loot/edit.jinja"
model = IngameDay
form_class = DayForm
context_object_name = "object"
class DayEditView(generic.UpdateView):
template_name = "loot/edit.html"
template_name = "loot/edit.jinja"
model = IngameDay
form_class = DayForm
@ -49,7 +49,7 @@ class DayEditView(generic.UpdateView):
class DayDeleteView(generic.DeleteView):
template_name = "common/confirm_delete.html"
template_name = "common/confirm_delete.jinja"
model = IngameDay
success_url = reverse_lazy('daylist')

View file

@ -1,6 +1,5 @@
{% extends "tenantbase.html" %}
{% load i18n %}
{% load humanize %}
{% extends "tenantbase.jinja" %}
{% import "macros.jinja" as macros %}
{% block content %}
<div class="row">
@ -8,37 +7,34 @@
<ul class="nav nav-pills flex-column">
{% for f in factions %}
<li class="nav-item">
<a href="{% url "factiondetail" f.slug %}"
<a href="{{ url("factiondetail", f.slug) }}"
class="nav-link {% if f.id == faction.id %}active{% endif %}">
{{ f.name }}
</a>
</li>
{% endfor %}
</ul>
<a class="btn btn-primary add-button" href="{% url "factionadd" %}">{% translate "Add Faction" %}</a>
<a class="btn btn-primary add-button" href="{{ url("factionadd") }}">{{ _("Add Faction") }}</a>
</div>
<div class="col-8">
<div class="faction-heading">
<h1>
{{ faction.name }}
<a href="{% url "factionedit" faction.slug %}">
{% translate "Edit" %}
<a href="{{ url("factionedit", faction.slug) }}">
{{ _("Edit") }}
</a>
</h1>
</div>
<dl>
<dt>{% translate "Members" %}:</dt>
<dt>{{ _("Members") }}:</dt>
<dd>
{% for char in faction.characters.all %}
<a href="{{ char.get_absolute_url }}">{{ char.name }}</a>
{% for char in faction.characters.all() %}
<a href="{{ char.get_absolute_url() }}">{{ char.name }}</a>
{% endfor %}
</dd>
</dl>
{{ faction.description_html|safe }}
<div>
<small>{% translate "Last updated" %}: {{ faction.last_modified|naturaltime }}
{% translate "by" %} {{ faction.history.first.history_user }} </small>
</div>
{{ macros.last_edited(faction) }}
</div>
</div>
{% endblock %}

View file

@ -15,7 +15,7 @@ def list_faction_redirect(request, *args, **kwargs):
class FactionDetailView(generic.DetailView):
template_name = "factions/detail.html"
template_name = "factions/detail.jinja"
model = Faction
context_object_name = "faction"
@ -26,14 +26,14 @@ class FactionDetailView(generic.DetailView):
class FactionCreateView(generic.CreateView):
template_name = "loot/edit.html"
template_name = "loot/edit.jinja"
model = Faction
form_class = FactionForm
context_object_name = "object"
class FactionEditView(generic.UpdateView):
template_name = "loot/edit.html"
template_name = "loot/edit.jinja"
model = Faction
form_class = FactionForm
@ -44,6 +44,6 @@ class FactionEditView(generic.UpdateView):
class FactionDeleteView(generic.DeleteView):
template_name = "common/confirm_delete.html"
template_name = "common/confirm_delete.jinja"
model = Faction
success_url = reverse_lazy('factionlist')

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-15 19:45+0200\n"
"POT-Creation-Date: 2021-10-15 20:50+0200\n"
"PO-Revision-Date: 2021-10-03 17:19+0200\n"
"Last-Translator: Lukas Winkler <translations@lw1.at>\n"
"Language-Team: \n"
@ -32,16 +32,16 @@ msgid "Add new campaign"
msgstr "Neue Campagne erstellen"
#: campaigns/templates/campaigns/campaign_edit.jinja:9
#: loot/templates/loot/edit.html:29 loot/templates/loot/edit.html:32
#: loot/templates/loot/edit.jinja:25 loot/templates/loot/edit.jinja:28
msgid "Add"
msgstr "Hinzufügen"
#: campaigns/templates/campaigns/campaign_overview.jinja:3
#: campaigns/templates/campaigns/campaign_overview.jinja:8
#: campaigns/templates/campaigns/campaign_overview.jinja:9
msgid "Campaign Overview"
msgstr "Kampagnenübersicht"
#: campaigns/templates/campaigns/campaign_overview.jinja:13
#: campaigns/templates/campaigns/campaign_overview.jinja:14
msgid "create Campaign"
msgstr "Campaign erstellen"
@ -53,7 +53,7 @@ msgstr "Spitzname"
msgid "Subtitle"
msgstr "Untertitel"
#: characters/models.py:26 characters/templates/characters/detail.html:48
#: characters/models.py:26 characters/templates/characters/detail.jinja:45
msgid "Player"
msgstr "Spieler"
@ -61,13 +61,13 @@ msgstr "Spieler"
msgid "If no player is selected, this character is considered an NPC."
msgstr "Wenn kein Spieler ausgewählt ist, ist dies ein NPC."
#: characters/models.py:32 characters/templates/characters/detail.html:52
#: characters/models.py:32 characters/templates/characters/detail.jinja:49
#: factions/models.py:15
msgid "Faction"
msgstr "Fraktion"
#: characters/models.py:36 locations/models.py:25 loot/models.py:24
#: loot/templates/loot/overview.html:19
#: loot/templates/loot/overview.jinja:17
msgid "Location"
msgstr "Ort"
@ -96,30 +96,27 @@ msgstr "Charakter"
msgid "Characters"
msgstr "Charaktere"
#: characters/templates/characters/detail.html:20
#: characters/templates/characters/detail.jinja:17
msgid "Add Character"
msgstr "Charakter hinzufügen"
#: characters/templates/characters/detail.html:41
#: days/templates/days/day_detail.html:25
#: characters/templates/characters/detail.jinja:38
#: days/templates/days/day_detail.jinja:24
#: factions/templates/factions/detail.html:25
#: loot/templates/loot/overview.html:54
#: locations/templates/locations/detail.jinja:22
#: loot/templates/loot/overview.jinja:51
msgid "Edit"
msgstr "Bearbeiten"
#: characters/templates/characters/detail.html:70
#: days/templates/days/day_detail.html:36
#: characters/templates/characters/detail.jinja:66
#: factions/templates/factions/detail.html:39
#: locations/templates/locations/detail.html:71
#: notes/templates/notes/detail.html:61
#: notes/templates/notes/detail.html:61 templates/macros.jinja:28
msgid "Last updated"
msgstr "Zuletzt geändert"
#: characters/templates/characters/detail.html:71
#: days/templates/days/day_detail.html:37
#: characters/templates/characters/detail.jinja:67
#: factions/templates/factions/detail.html:40
#: locations/templates/locations/detail.html:72
#: notes/templates/notes/detail.html:62
#: notes/templates/notes/detail.html:62 templates/macros.jinja:29
msgid "by"
msgstr "von"
@ -139,7 +136,7 @@ msgstr "Datum"
msgid "Session"
msgstr "Session"
#: days/models.py:17 days/templates/days/day_detail.html:31
#: days/models.py:17 days/templates/days/day_detail.jinja:30
msgid "Sessions"
msgstr "Sessions"
@ -155,7 +152,7 @@ msgstr "Tage"
msgid "day"
msgstr "Tag"
#: days/templates/days/day_detail.html:18
#: days/templates/days/day_detail.jinja:17
msgid "Add Day"
msgstr "Tag hinzufügen"
@ -172,7 +169,7 @@ msgstr "Fraktion hinzufügen"
msgid "Members"
msgstr "Mitglieder"
#: locations/models.py:18 locations/templates/locations/detail.html:44
#: locations/models.py:18 locations/templates/locations/detail.jinja:41
#: notes/models.py:18 notes/templates/notes/detail.html:44
msgid "Part of"
msgstr "Teil von"
@ -188,15 +185,15 @@ msgstr "Token Bild"
msgid "Locations"
msgstr "Orte"
#: locations/templates/locations/detail.html:18
#: locations/templates/locations/detail.jinja:15
msgid "Add Location"
msgstr "Ort hinzufügen"
#: locations/templates/locations/detail.html:48
#: locations/templates/locations/detail.jinja:45
msgid "Contains"
msgstr ""
#: loot/models.py:12 loot/templates/loot/overview.html:16
#: loot/models.py:12 loot/templates/loot/overview.jinja:14
msgid "Quantity"
msgstr "Anzahl"
@ -208,7 +205,7 @@ msgstr "Wert (Gold)"
msgid "Weight (lb)"
msgstr "Gewicht (lb)"
#: loot/models.py:18 loot/templates/loot/overview.html:18
#: loot/models.py:18 loot/templates/loot/overview.jinja:16
msgid "Claimant"
msgstr "Beansprucht von"
@ -216,56 +213,52 @@ msgstr "Beansprucht von"
msgid "Magic Item"
msgstr "Magisches Item"
#: loot/models.py:31 loot/models.py:32 loot/templates/loot/overview.html:5
#: loot/templates/loot/overview.html:8 templates/tenantbase.html:45
#: loot/models.py:31 loot/models.py:32 loot/templates/loot/overview.jinja:3
#: loot/templates/loot/overview.jinja:6 templates/tenantbase.html:45
#: templates/tenantbase.jinja:42
msgid "Loot"
msgstr "Loot"
#: loot/templates/loot/edit.html:8
#: loot/templates/loot/edit.jinja:5
#, python-format
msgid "Edit \"%(name)s\""
msgstr "\"%(name)s\" bearbeiten"
#: loot/templates/loot/edit.html:10 loot/templates/loot/edit.html:12
#: loot/templates/loot/edit.html:14 loot/templates/loot/edit.html:16
#: loot/templates/loot/edit.jinja:7 loot/templates/loot/edit.jinja:9
#: loot/templates/loot/edit.jinja:11 loot/templates/loot/edit.jinja:13
msgid "Delete"
msgstr "Löschen"
#: loot/templates/loot/edit.html:19
#: loot/templates/loot/edit.jinja:16
msgid "Add new"
msgstr "Neu erstellen"
#: loot/templates/loot/edit.html:29 loot/templates/loot/edit.html:32
#: loot/templates/loot/edit.jinja:25 loot/templates/loot/edit.jinja:28
#: templates/common/languageselect.html:19
#: templates/registration/registration_form.html:13
#: users/templates/users/edit.html:13
msgid "Save"
msgstr "Speichern"
#: loot/templates/loot/overview.html:15
#: loot/templates/loot/overview.jinja:13
msgid "Item"
msgstr "Objekt"
#: loot/templates/loot/overview.html:17 loot/templates/loot/overview.html:74
#: loot/templates/loot/overview.jinja:15 loot/templates/loot/overview.jinja:72
msgid "Total Value"
msgstr "Gesamtwert"
#: loot/templates/loot/overview.html:41
msgid "Nobody"
msgstr "Niemand"
#: loot/templates/loot/overview.html:58
#: loot/templates/loot/overview.jinja:56
msgid "Value each"
msgstr "Wert pro Stück"
#: loot/templates/loot/overview.html:62
#: loot/templates/loot/overview.jinja:60
#, fuzzy
#| msgid "Weight (lb)"
msgid "Weight"
msgstr "Gewicht (lb)"
#: loot/templates/loot/overview.html:77
#: loot/templates/loot/overview.jinja:75
msgid "Add Loot"
msgstr "Loot hinzufügen"
@ -282,11 +275,11 @@ msgstr "Notizen"
msgid "Add Note"
msgstr "Notiz hinzufügen"
#: rpg_notes/settings.py:194
#: rpg_notes/settings.py:195
msgid "German"
msgstr "Deutsch"
#: rpg_notes/settings.py:195
#: rpg_notes/settings.py:196
msgid "English"
msgstr "Englisch"
@ -310,10 +303,6 @@ msgstr "Abmelden"
msgid "Log in"
msgstr "Anmelden"
#: templates/base.jinja:42
msgid "test"
msgstr ""
#: templates/common/homepage.jinja:8
msgid ""
"An experimental, collaborative note taking app and wiki optimized for RPG "
@ -399,3 +388,6 @@ msgstr ""
#: users/views.py:61
msgid "User account was updated successfully"
msgstr ""
#~ msgid "Nobody"
#~ msgstr "Niemand"

View file

@ -1,8 +1,5 @@
{% extends "tenantbase.html" %}
{% load i18n %}
{% load thumbutils %}
{% load thumbnail %}
{% load humanize %}
{% extends "tenantbase.jinja" %}
{% import "macros.jinja" as macros %}
{% block content %}
<div class="row">
@ -10,26 +7,26 @@
<div class="list-group">
{% for p in roots %}
<a class="tree-{{ p.tree_depth }} list-group-item list-group-item-action {% if location.id == p.id %}active{% endif %}"
href="{{ p.get_absolute_url }}">
href="{{ p.get_absolute_url() }}">
{{ p }}
</a>
{% endfor %}
</div>
<a class="btn btn-primary" href="{% url "locationadd" %}">{% translate "Add Location" %}</a>
<a class="btn btn-primary" href="{{ url("locationadd") }} ">{{ _("Add Location") }}</a>
</div>
<div class="col-8">
<div class="character-heading">
<h1>
{{ location.name }}
<a href="{% url "locationedit" location.slug %}">
edit
<a href="{{ url("locationedit", location.slug) }}">
{{ _("Edit") }}
</a>
</h1>
<nav aria-label="breadcrumb" class="breadcrumbs">
<ol class="breadcrumb">
{% for ancestor in location.ancestors %}
{% for ancestor in location.ancestors() %}
<li class="breadcrumb-item">
<a href="{{ ancestor.get_absolute_url }}">{{ ancestor }}</a>
<a href="{{ ancestor.get_absolute_url() }}">{{ ancestor }}</a>
</li>
{% endfor %}
<li class="breadcrumb-item active" aria-current="page">
@ -41,36 +38,32 @@
<dl>
{% if location.part_of %}
<dt>{% translate "Part of" %}:</dt>
<dd><a href="{{ location.part_of.get_absolute_url }}">{{ location.part_of }}</a></dd>
<dt>{{ _("Part of") }}:</dt>
<dd><a href="{{ location.part_of.get_absolute_url() }}">{{ location.part_of }}</a></dd>
{% endif %}
{% if location.loot %}
<dt>{% translate "Contains" %}:</dt>
<dt>{{ _("Contains") }}:</dt>
<dd>
<ul>
{% for l in location.loot.all %}
<li><a href="{{ l.get_absolute_url }}">{{ l.name }}</a></li>
{% for l in location.loot.all() %}
<li><a href="{{ l.get_absolute_url() }}">{{ l.name }}</a></li>
{% endfor %}
</ul>
</dd>
{% endif %}
{% if location.image %}
{% thumbnail location.image "860" crop="center" as im %}
{% set im=thumbnail(location.image, "860", crop="center") %}
<a href="{{ location.image.url }}" class="image-viewer">
<img class="img-fluid" src="{{ im.url }}"
width="{{ im.width }}"
height="{{ im.height }}"
srcset="{{ im.url|srcset }}">
</a>
{% endthumbnail %}
{% endif %}
</dl>
{{ location.description_html|safe }}
<div>
<small>{% translate "Last updated" %}: {{ location.last_modified|naturaltime }}
{% translate "by" %} {{ location.history.first.history_user }} </small>
</div>
{{ macros.last_edited(location) }}
</div>
</div>
{% endblock %}

View file

@ -15,7 +15,7 @@ def list_location_redirect(request, *args, **kwargs):
class LocationDetailView(generic.DetailView):
template_name = "locations/detail.html"
template_name = "locations/detail.jinja"
model = Location
context_object_name = "location"
@ -26,14 +26,14 @@ class LocationDetailView(generic.DetailView):
class LocationCreateView(generic.CreateView):
template_name = "loot/edit.html"
template_name = "loot/edit.jinja"
model = Location
form_class = LocationForm
context_object_name = "object"
class LocationEditView(generic.UpdateView):
template_name = "loot/edit.html"
template_name = "loot/edit.jinja"
model = Location
form_class = LocationForm
@ -44,6 +44,6 @@ class LocationEditView(generic.UpdateView):
class LocationDeleteView(generic.DeleteView):
template_name = "common/confirm_delete.html"
template_name = "common/confirm_delete.jinja"
model = Location
success_url = reverse_lazy('locationlist')

View file

@ -1,41 +0,0 @@
{% extends 'tenantbase.html' %}
{% load i18n %}
{% load django_bootstrap5 %}
{% load static %}
{% block heading %}
{% if edit %}
<h1>{% blocktrans with name=object.name %}Edit "{{ name }}"{% endblocktrans %}</h1>
{% if request.resolver_match.view_name == "lootedit" %}
<a class="btn btn-danger" href="{% url "lootdelete" object.id %}">{% translate "Delete" %}</a>
{% elif request.resolver_match.view_name == "dayedit" %}
<a class="btn btn-danger" href="{% url "daydelete" object.id %}">{% translate "Delete" %}</a>
{% elif request.resolver_match.view_name == "locationedit" %}
<a class="btn btn-danger" href="{% url "locationdelete" object.slug %}">{% translate "Delete" %}</a>
{% elif request.resolver_match.view_name == "characteredit" %}
<a class="btn btn-danger" href="{% url "characterdelete" object.slug %}">{% translate "Delete" %}</a>
{% endif %}
{% else %}
<h1>{% translate "Add new" %}</h1>
{% endif %}
{% endblock %}
{% block content %}
<form method="post"
{% if form.is_multipart %}enctype="multipart/form-data"{% endif %}>
{% csrf_token %}
<input type="submit" class="btn btn-primary"
value="{% if edit %}{% translate "Save" %}{% else %}{% translate "Add" %}{% endif %}">
{% bootstrap_form form %}
<input type="submit" class="btn btn-primary"
value="{% if edit %}{% translate "Save" %}{% else %}{% translate "Add" %}{% endif %}">
</form>
{% endblock %}
{% block extra_js %}
<script src="{% static "libs/easymde.min.js" %}"></script>
<script src="{% static "libs/fontawesome-solid.min.js" %}"></script>
<script src="{% static "libs/fontawesome.min.js" %}"></script>
<script src="{% static "js/markdown.js" %}"></script>
{% endblock %}

View file

@ -0,0 +1,37 @@
{% extends 'tenantbase.jinja' %}
{% block heading %}
{% if edit %}
<h1>{% trans name=object.name %}Edit "{{ name }}"{% endtrans %}</h1>
{% if request.resolver_match.view_name == "lootedit" %}
<a class="btn btn-danger" href="{{ url("lootdelete", object.id) }}">{{ _("Delete") }}</a>
{% elif request.resolver_match.view_name == "dayedit" %}
<a class="btn btn-danger" href="{{ url("daydelete", object.id) }}">{{ _("Delete") }}</a>
{% elif request.resolver_match.view_name == "locationedit" %}
<a class="btn btn-danger" href="{{ url("locationdelete", object.id) }}">{{ _("Delete") }}</a>
{% elif request.resolver_match.view_name == "characteredit" %}
<a class="btn btn-danger" href="{{ url("characterdelete", object.id) }}">{{ _("Delete") }}</a>
{% endif %}
{% else %}
<h1>{{ _("Add new") }}</h1>
{% endif %}
{% endblock %}
{% block content %}
<form method="post" {% if form.is_multipart %}enctype="multipart/form-data"{% endif %}>
{% csrf_token %}
<input type="submit" class="btn btn-primary"
value="{% if edit %}{{ _("Save") }}{% else %}{{ _("Add") }}{% endif %}">
{{ bootstrap_form(form) }}
<input type="submit" class="btn btn-primary"
value="{% if edit %}{{ _("Save") }}{% else %}{{ _("Add") }}{% endif %}">
</form>
{% endblock %}
{% block extra_js %}
<script src="{{ static("libs/easymde.min.js") }}"></script>
<script src="{{ static("libs/fontawesome-solid.min.js") }}"></script>
<script src="{{ static("libs/fontawesome.min.js") }}"></script>
<script src="{{ static("js/markdown.js") }}"></script>
{% endblock %}

View file

@ -1,22 +1,20 @@
{% extends "tenantbase.html" %}
{% load i18n %}
{% load formatters %}
{% extends "tenantbase.jinja" %}
{% block title %}{% translate "Loot" %}{% endblock %}
{% block title %}{% trans %}Loot{% endtrans %} {% endblock %}
{% block heading %}
<h1>{% translate "Loot" %}</h1>
<h1>{% trans %}Loot{% endtrans %}</h1>
{% endblock %}
{% block content %}
<table class="table">
<thead>
<tr>
<td></td>
<td>{% translate "Item" %}</td>
<td>{% translate "Quantity" %}</td>
<td>{% translate "Total Value" %}</td>
<td>{% translate "Claimant" %}</td>
<td>{% translate "Location" %}</td>
<td>{{ _("Item") }}</td>
<td>{{ _("Quantity") }}</td>
<td>{{ _("Total Value") }}</td>
<td>{{ _("Claimant") }}</td>
<td>{{ _("Location") }}</td>
<td></td>
</tr>
</thead>
@ -38,9 +36,8 @@
<td>{{ l.name }}</td>
<td>{{ l.quantity }}</td>
<td>{{ l.value_gold|format_money_html }}</td>
{% trans 'Nobody' as nobody %}
<td>{{ l.owner|default:nobody }}</td>
<td>{{ l.location|default:"" }}</td>
<td>{{ l.owner|default(_('Nobody')) }}</td>
<td>{{ l.location|default("") }}</td>
<td>
<svg class="chev" viewBox="0 0 640 1024" xmlns="http://www.w3.org/2000/svg">
<path d="M512 320L320 512 128 320 0 448l320 320 320-320L512 320z"/>
@ -51,15 +48,16 @@
<td colspan="7" class="collapse-cell">
<div class="collapse" id="row-{{ l.id }}">
<div class="cell-box">
<h3>{{ l.name }} <a href="{% url "lootedit" l.id %}">{% translate "Edit" %}</a></h3>
<h3>{{ l.name }} <a href="{{ url("lootedit", l.id) }}">{{ _("Edit") }}</a>
</h3>
{{ l.description_html|safe }}
<dl>
{% if l.value_per_unit and l.quantity > 1 %}
<dt>{% translate "Value each" %}</dt>
<dt>{{ _("Value each") }}</dt>
<dd>{{ l.value_per_unit|format_money_html }}</dd>
{% endif %}
{% if l.weight %}
<dt>{% translate "Weight" %}</dt>
<dt>{{ _("Weight") }}</dt>
<dd>{{ l.weight }} lb</dd>
{% endif %}
</dl>
@ -71,10 +69,10 @@
</tbody>
</table>
<dl>
<dd>{% translate "Total Value" %}:</dd>
<dd>{{ _("Total Value") }}:</dd>
<dt>{{ total_value|format_money_html }}</dt>
</dl>
<a href="{% url "lootadd" %}" class="btn btn-primary">{% translate "Add Loot" %}</a>
<a href="{{ url("lootadd") }} " class="btn btn-primary">{{ _("Add Loot") }}</a>
{% endblock %}

View file

@ -7,7 +7,7 @@ from loot.models import Loot
class LootListView(generic.ListView):
template_name = "loot/overview.html"
template_name = "loot/overview.jinja"
model = Loot
context_object_name = "loot"
@ -24,7 +24,7 @@ class LootListView(generic.ListView):
class LootCreateView(generic.CreateView):
template_name = "loot/edit.html"
template_name = "loot/edit.jinja"
model = Loot
form_class = LootForm
@ -32,7 +32,7 @@ class LootCreateView(generic.CreateView):
class LootEditView(generic.UpdateView):
template_name = "loot/edit.html"
template_name = "loot/edit.jinja"
model = Loot
form_class = LootForm
context_object_name = "object"
@ -46,7 +46,7 @@ class LootEditView(generic.UpdateView):
class LootDeleteView(generic.DeleteView):
template_name = "common/confirm_delete.html"
template_name = "common/confirm_delete.jinja"
model = Loot
success_url = reverse_lazy("lootlist")

View file

@ -1,8 +1,5 @@
{% extends "tenantbase.html" %}
{% load i18n %}
{% load thumbutils %}
{% load thumbnail %}
{% load humanize %}
{% extends "tenantbase.jinja" %}
{% import "macros.jinja" as macros %}
{% block content %}
<div class="row">
@ -10,26 +7,26 @@
<div class="list-group">
{% for p in roots %}
<a class="tree-{{ p.tree_depth }} list-group-item list-group-item-action {% if note.id == p.id %}active{% endif %}"
href="{{ p.get_absolute_url }}">
href="{{ p.get_absolute_url() }}">
{{ p }}
</a>
{% endfor %}
</div>
<a class="btn btn-primary" href="{% url "noteadd" %}">{% translate "Add Note" %}</a>
<a class="btn btn-primary" href="{{ url("noteadd") }} ">{{ _("Add Note") }}</a>
</div>
<div class="col-8">
<div class="character-heading">
<h1>
{{ note.name }}
<a href="{% url "noteedit" note.slug %}">
edit
<a href="{{ url("noteedit", note.slug) }}">
{{ _("Edit") }}
</a>
</h1>
<nav aria-label="breadcrumb" class="breadcrumbs">
<ol class="breadcrumb">
{% for ancestor in note.ancestors %}
{% for ancestor in note.ancestors() %}
<li class="breadcrumb-item">
<a href="{{ ancestor.get_absolute_url }}">{{ ancestor }}</a>
<a href="{{ ancestor.get_absolute_url() }}">{{ ancestor }}</a>
</li>
{% endfor %}
<li class="breadcrumb-item active" aria-current="page">
@ -41,26 +38,22 @@
<dl>
{% if note.part_of %}
<dt>{% translate "Part of" %}:</dt>
<dd><a href="{{ note.part_of.get_absolute_url }}">{{ note.part_of }}</a></dd>
<dt>{{ _("Part of") }}:</dt>
<dd><a href="{{ note.part_of.get_absolute_url() }}">{{ note.part_of }}</a></dd>
{% endif %}
{% if note.image %}
{% thumbnail note.image "860" crop="center" as im %}
{% set im=thumbnail(note.image, "860", crop="center") %}
<a href="{{ note.image.url }}" class="image-viewer">
<img class="img-fluid" src="{{ im.url }}"
width="{{ im.width }}"
height="{{ im.height }}"
srcset="{{ im.url|srcset }}">
</a>
{% endthumbnail %}
{% endif %}
</dl>
{{ note.description_html|safe }}
<div>
<small>{% translate "Last updated" %}: {{ note.last_modified|naturaltime }}
{% translate "by" %} {{ note.history.first.history_user }} </small>
</div>
{{ macros.last_edited(note) }}
</div>
</div>
{% endblock %}

View file

@ -15,7 +15,7 @@ def list_note_redirect(request, *args, **kwargs):
class NoteDetailView(generic.DetailView):
template_name = "notes/detail.html"
template_name = "notes/detail.jinja"
model = Note
context_object_name = "note"
@ -26,14 +26,14 @@ class NoteDetailView(generic.DetailView):
class NoteCreateView(generic.CreateView):
template_name = "loot/edit.html"
template_name = "loot/edit.jinja"
model = Note
form_class = NoteForm
context_object_name = "object"
class NoteEditView(generic.UpdateView):
template_name = "loot/edit.html"
template_name = "loot/edit.jinja"
model = Note
form_class = NoteForm
@ -44,6 +44,6 @@ class NoteEditView(generic.UpdateView):
class NoteDeleteView(generic.DeleteView):
template_name = "common/confirm_delete.html"
template_name = "common/confirm_delete.jinja"
model = Note
success_url = reverse_lazy('notelist')

View file

@ -126,10 +126,9 @@ TEMPLATES = [
# 'jdj_tags.extensions.DjangoCompat',
# ]
'context_processors': [
'django.template.context_processors.request',
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.contrib.messages.context_processors.messages',
],
"bytecode_cache": {

View file

@ -7,7 +7,7 @@ from common import views
from rpg_notes import settings
urlpatterns = [
path('', include('django.contrib.auth.urls')),
path('', include('rpg_notes.urls_auth')),
path('i18n/', include('django.conf.urls.i18n')),
path("language/", views.LanguageSelectView.as_view(), name="change_language"),
# path("ip", views.print_ip, name="ip"),

25
rpg_notes/urls_auth.py Normal file
View file

@ -0,0 +1,25 @@
# The views used below are normally mapped in the AdminSite instance.
# This URLs file is used to provide a reliable view deployment for test purposes.
# It is also provided as a convenience to those who want to deploy these URLs
# elsewhere.
from django.contrib.auth import views
from django.urls import path
class CustomLoginView(views.LoginView):
template_name = "registration/login.jinja"
urlpatterns = [
path('login/', CustomLoginView.as_view(), name='login'),
path('logout/', views.LogoutView.as_view(), name='logout'),
path('password_change/', views.PasswordChangeView.as_view(), name='password_change'),
path('password_change/done/', views.PasswordChangeDoneView.as_view(), name='password_change_done'),
path('password_reset/', views.PasswordResetView.as_view(), name='password_reset'),
path('password_reset/done/', views.PasswordResetDoneView.as_view(), name='password_reset_done'),
path('reset/<uidb64>/<token>/', views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'),
path('reset/done/', views.PasswordResetCompleteView.as_view(), name='password_reset_complete'),
]

View file

@ -2,6 +2,7 @@ import debug_toolbar
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
from django_jinja.views import PermissionDenied
from common import views
from rpg_notes import settings
@ -9,7 +10,7 @@ from users import views as user_views
urlpatterns = [
path('', include('users.urls')),
path('', include('django.contrib.auth.urls')),
path('', include('rpg_notes.urls_auth')),
path('', views.PublicHomepageView.as_view()),
path("profile/", user_views.UserEditView.as_view(), name="edit_profile"),
path('admin/', admin.site.urls),

View file

@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "base.jinja" %}
{% load i18n %}
{% load urls %}

View file

@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "base.jinja" %}
{% block mainpage %}

View file

@ -1,68 +0,0 @@
{% load i18n %}
{% load version %}
{% load django_bootstrap5 %}
{% load static %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}{% endblock %} - RPGnotes</title>
<!-- Bootstrap -->
{% if debug %}
<link rel="stylesheet" href="{% url "css" %}">
{% else %}
<link rel="stylesheet" href="{% static "css/main.css" %}">
{% endif %}
</head>
<body>
<div class="container">
{% bootstrap_messages %}
{% block mainpage %}{% endblock %}
</div>
<footer>
<nav class="navbar navbar-dark bg-dark navbar-expand">
<div class="container-fluid">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="https://github.com/Findus23/RPGnotes/tree/{% commit_id %}"
target="_blank" rel="noopener" title="{% commit_id %}">
Source
</a>
</li>
<li class="nav-item">
{% if user.is_authenticated %}
<a class="nav-link" href="{% url "logout" %}">{% translate "Log out" %}</a>
{% else %}
<a class="nav-link" href="{% url "login" %}">{% translate "Log in" %}</a>
{% endif %}
</ul>
</div>
</nav>
</footer>
<script src="{% static "libs/bootstrap.min.js" %}"></script>
<script src="{% static "libs/luminous.min.js" %}"></script>
<script nonce="{{ request.csp_nonce }}">
document.addEventListener('DOMContentLoaded', function () {
const galleries = document.querySelectorAll("a.image-viewer");
console.info(galleries)
new LuminousGallery(galleries)
});
</script>
{% if sentry_event_id %}
<script src="{% static "libs/bundle.min.js" %}"></script>
<script nonce="{{ request.csp_nonce }}">
Sentry.init({dsn: "{{ sentry_dsn }}"});
{% get_current_language as LANGUAGE_CODE %}
Sentry.showReportDialog({eventId: "{{ sentry_event_id }}", lang: "{{ LANGUAGE_CODE }}"});
</script>
{% endif %}
{% block extra_js %}{% endblock %}
</body>
</html>

View file

@ -54,8 +54,7 @@
<script src="{{ static("libs/bundle.min.js") }}"></script>
<script nonce="{{ request.csp_nonce }}">
Sentry.init({dsn: "{{ sentry_dsn }}"});
{# {% get_current_language as LANGUAGE_CODE %}#}
Sentry.showReportDialog({eventId: "{{ sentry_event_id }}"});
Sentry.showReportDialog({eventId: "{{ sentry_event_id }}", lang: "{{ language_code() }}"});
</script>
{% endif %}
{% block extra_js %}{% endblock %}

View file

@ -1,6 +1,4 @@
{% extends 'tenantbase.html' %}
{% load django_bootstrap5 %}
{% load static %}
{% extends 'tenantbase.jinja' %}
{% block heading %}
<h1>Delete Object</h1>
@ -11,4 +9,5 @@
<form method="post">{% csrf_token %}
<p>Are you sure you want to delete "{{ object }}"?</p>
<input class="btn btn-primary" type="submit" value="Confirm">
</form>{% endblock %}
</form>
{% endblock %}

View file

@ -1,22 +0,0 @@
{% extends "tenantbase.html" %}
{% load i18n %}
{% block content %}
<h1>{% translate "Change Language" %}</h1>
<form action="{% url 'set_language' %}" method="post">{% csrf_token %}
<div class="input-group">
<select name="language" class="form-select">
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
<option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected{% endif %}>
{{ language.name_local }} ({{ language.code }})
</option>
{% endfor %}
</select>
<button type="submit" class="btn btn-outline-secondary">{% translate "Save" %}</button>
</div>
</form>
{% endblock %}

View file

@ -0,0 +1,20 @@
{% extends "tenantbase.jinja" %}
{% block title %}{{ _("Change Language") }} - RPGnotes{% endblock %}
{% block content %}
<h1>{{ _("Change Language") }}</h1>
<form action="{{ url("set_language") }}" method="post">{% csrf_token %}
<div class="input-group">
<select name="language" class="form-select">
{% set current_langcode=language_code() %}
{% for code,language in all_languages() %}
<option value="{{ code }}"{% if code == current_langcode %} selected{% endif %}>
{{ language }} ({{ code }})
</option>
{% endfor %}
</select>
<button type="submit" class="btn btn-outline-secondary">{{ _("Save") }}</button>
</div>
</form>
{% endblock %}

View file

@ -0,0 +1,31 @@
{% macro character_pillar(character) %}
<li class="nav-item">
<div class="side-card">
<div class="image-col">
{% if character.smaller_image %}
{% set im=thumbnail(character.smaller_image, "48x48", crop="center") %}
<img class="avatar avatar-image rounded-circle" src="{{ im.url }}" width="{{ im.width }}"
height="{{ im.height }}"
srcset="{{ im.url|srcset }}">
{% else %}
<div class="avatar avatar-text"
style="background: {{ character.color }};color:{{ character.text_color }}">{{ character.initials }}</div>
{% endif %}
</div>
<div class="text-col">
<a class="stretched-link"
href="{{ character.get_absolute_url() }}">
{{ character.name }}
</a>
<div>{{ character.subtitle }}</div>
</div>
</div>
</li>
{% endmacro %}
{% macro last_edited(obj) %}
<div>
<small>{{ _("Last updated") }}: {{ obj.last_modified|naturaltime }}
{{ _("by") }} {{ obj.history.first().history_user }} </small>
</div>
{% endmacro %}

View file

@ -1,25 +0,0 @@
{% load thumbutils %}
{% load thumbnail %}
<li class="nav-item">
<div class="side-card">
<div class="image-col">
{% if character.smaller_image %}
{% thumbnail character.smaller_image "48x48" crop="center" as im %}
<img class="avatar avatar-image rounded-circle" src="{{ im.url }}" width="{{ im.width }}"
height="{{ im.height }}"
srcset="{{ im.url|srcset }}">
{% endthumbnail %}
{% else %}
<div class="avatar avatar-text"
style="background: {{ character.color }};color:{{ character.text_color }}">{{ character.initials }}</div>
{% endif %}
</div>
<div class="text-col">
<a class="stretched-link"
href="{{ character.get_absolute_url }}">
{{ character.name }}
</a>
<div>{{ character.subtitle }}</div>
</div>
</div>
</li>

View file

@ -1,8 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% block mainpage %}
<h1>{% translate "Activation failed" %}</h1>
<p>Maybe this activation link has already been clicked before.</p>
{% endblock %}

View file

@ -0,0 +1,8 @@
{% extends 'base.jinja' %}
{% load i18n %}
{% block mainpage %}
<h1>{% trans %}Activation failed{% endtrans %} </h1>
<p>{% trans %}Maybe this activation link has already been clicked before.{% endtrans %} </p>
{% endblock %}

View file

@ -1,28 +0,0 @@
{% extends "base.html" %}
{% load i18n %}
{% load django_bootstrap5 %}
{% load static %}
{% block mainpage %}
<h1>{% translate "Login" %}</h1>
{% if next %}
<div class="alert alert-info">
{% blocktranslate %}You need to log in before you can access <code>{{ next }}</code>.{% endblocktranslate %}
</div>
{% endif %}
<form method="post" class="form">
{% csrf_token %}
{% bootstrap_form form %}
{% url 'admin_password_reset' as password_reset_url %}
<div class="password-reset-link">
<a href="{% url 'password_reset' %}">{% translate "Forgotten your password or username?" %}</a>
</div>
<button type="submit" class="btn btn-lg btn-primary btn-block">
{% translate "Log in" %}
</button>
</form>
{% endblock %}

View file

@ -0,0 +1,24 @@
{% extends "base.jinja" %}
{% block mainpage %}
<h1>{{ _("Login") }}</h1>
{% if next %}
<div class="alert alert-info">
{% trans %}You need to log in before you can access <code>{{ next }}</code>.{% endtrans %}
</div>
{% endif %}
<form method="post" class="form">
{% csrf_token %}
{{ bootstrap_form(form) }}
<div class="password-reset-link">
<a href="{{ url("password_reset") }}">{% trans %}Forgotten your password or username?{% endtrans %} </a>
</div>
<button type="submit" class="btn btn-lg btn-primary btn-block">
{{ _("Log in") }}
</button>
</form>
{% endblock %}

View file

@ -1,7 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% block mainpage %}
<h1>{% translate "Registration closed" %}</h1>
{% endblock %}

View file

@ -0,0 +1,6 @@
{% extends 'base.jinja' %}
{% block mainpage %}
<h1>{{ _("Registration closed") }}</h1>
{% endblock %}

View file

@ -1,7 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% block mainpage %}
<h1>{% translate "Registration complete" %}</h1>
{% endblock %}

View file

@ -0,0 +1,6 @@
{% extends 'base.jinja' %}
{% block mainpage %}
<h1>{{ _("Registration complete") }}</h1>
{% endblock %}

View file

@ -1,15 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% load django_bootstrap5 %}
{% load static %}
{% block mainpage %}
<h1>{% translate "Registration" %}</h1>
<form method="post">
{% csrf_token %}
{% bootstrap_form form %}
<input type="submit" class="btn btn-primary" value="{% translate "Save" %}">
</form>
{% endblock %}

View file

@ -0,0 +1,11 @@
{% extends 'base.jinja' %}
{% block mainpage %}
<h1>{{ _("Registration") }}</h1>
<form method="post">
{% csrf_token %}
{{ bootstrap_form(form) }}
<input type="submit" class="btn btn-primary" value="{{ _("Save") }}">
</form>
{% endblock %}

View file

@ -1,77 +0,0 @@
{% extends "base.html" %}
{% load urls %}
{% load i18n %}
{% load version %}
{% block title %}{{ object }}{% endblock %}
{% block mainpage %}
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav me-auto">
{% with url_name=request.resolver_match.url_name %}
<li class="nav-item">
<a class="nav-link {% if url_name == 'campaigndetail' %}active{% endif %}"
href="{% url "campaigndetail" %}">{% translate "Home" %}</a>
</li>
<li class="nav-item">
<a class="nav-link {% if url_name == 'characterdetail' %}active{% endif %}"
href="{% url "characterlist" %}">{% translate "Characters" %}</a>
</li>
<li class="nav-item">
<a class="nav-link {% if url_name == 'locationdetail' %}active{% endif %}"
href="{% url "locationlist" %}">{% translate "Locations" %}</a>
</li>
<li class="nav-item">
<a class="nav-link {% if url_name == 'notedetail' %}active{% endif %}"
href="{% url "notelist" %}">{% translate "Notes" %}</a>
</li>
<li class="nav-item">
<a class="nav-link {% if url_name == 'factiondetail' %}active{% endif %}"
href="{% url "factionlist" %}">{% translate "Factions" %}</a>
</li>
<li class="nav-item">
<a class="nav-link {% if url_name == 'daydetail' %}active{% endif %}"
href="{% url "daylist" %}">{% translate "Timeline" %}</a>
</li>
<li class="nav-item">
<a class="nav-link {% if url_name == 'lootlist' %}active{% endif %}"
href="{% url "lootlist" %}">{% translate "Loot" %}</a>
</li>
{% endwith %}
</ul>
<ul class="navbar-nav">
<li class="nav-item dropdown">
<a href="#" class="navbar-text nav-link dropdown-toggle" id="navbarDropdown" role="button"
data-bs-toggle="dropdown"
aria-expanded="false">{{ user }}</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item"
href="{% url "change_language" %}">{% translate "Change Language" %}</a></li>
{% if user.is_staff %}
<li><a class="dropdown-item" href="/admin/">Admin</a></li>
{% endif %}
<li><a class="dropdown-item"
href="{% main_url %}/profile/">{% translate "Edit User Account" %}</a></li>
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" href="{% url "logout" %}">{% translate "Log out" %}</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
{% block heading %}{% endblock %}
{% block content %}
{% endblock %}
{% endblock %}

View file

@ -55,8 +55,8 @@
{% if user.is_staff %}
<li><a class="dropdown-item" href="/admin/">Admin</a></li>
{% endif %}
{# <li><a class="dropdown-item"#}
{# href="{% main_url %}/profile/">{% trans %}Edit User Account{% endtrans %}</a></li>#}
<li><a class="dropdown-item"
href="{{ main_url() }}/profile/">{% trans %}Edit User Account{% endtrans %}</a></li>
<li>
<hr class="dropdown-divider">
</li>

View file

@ -1,16 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% load django_bootstrap5 %}
{% load static %}
{% block mainpage %}
<h1>{% translate "Edit User Account" %}</h1>
<form method="post">
{% csrf_token %}
{% bootstrap_form form %}
<input type="submit" class="btn btn-primary" value="{% translate "Save" %}">
</form>
{% endblock %}

View file

@ -0,0 +1,13 @@
{% extends 'base.jinja' %}
{% block mainpage %}
<h1>{{ _("Edit User Account") }}</h1>
<form method="post">
{{ csrf_token }}
{{ bootstrap_form(form) }}
<input type="submit" class="btn btn-primary" value="{{ _("Save") }}">
</form>
{% endblock %}

View file

@ -17,7 +17,7 @@ urlpatterns = [
path(
"register/closed/",
TemplateView.as_view(
template_name="registration/registration_closed.html"
template_name="registration/registration_closed.jinja"
),
name="django_registration_disallowed",
),

View file

@ -13,7 +13,7 @@ from users.models import TenantUser
class CustomRegistrationView(RegistrationView):
email_body_template = "registration/activation_email_body.html"
email_subject_template = "registration/activation_email_subject.html"
template_name = "registration/registration_form.html"
template_name = "registration/registration_form.jinja"
form_class = CustomRegistrationForm
success_url = reverse_lazy("login")
@ -40,7 +40,7 @@ class CustomRegistrationView(RegistrationView):
class CustomActivationView(ActivationView):
success_url = reverse_lazy("login")
template_name = "registration/activation_failed.html"
template_name = "registration/activation_failed.jinja"
def activate(self, *args, **kwargs):
username = self.validate_key(kwargs.get("activation_key"))
@ -54,7 +54,7 @@ class CustomActivationView(ActivationView):
class UserEditView(SuccessMessageMixin, UpdateView):
template_name = "users/edit.html"
template_name = "users/edit.jinja"
model = TenantUser
form_class = CustomUserChangeForm
success_url = "/"