Compare commits

106 Commits

Author SHA1 Message Date
e64cc4bd5f Merge branch 'develop'
# Conflicts:
#	src/locale/en/LC_MESSAGES/django.po
2025-11-09 17:55:11 +01:00
a498971d66 feat: create directory in one go, don't use cache dir and use more standard entrypoint.sh 2025-11-09 17:36:48 +01:00
527ab07b6f trans: fis various 2025-11-08 00:33:35 +01:00
e2e236d650 feat: add button to download all logs 2025-11-08 00:00:54 +01:00
c4100a9ade trans: fix various 2025-11-07 18:17:53 +01:00
9511b46af0 feat: deactivate cache in dev config 2025-11-07 18:13:30 +01:00
5b906a7708 feat: add clean method 2025-11-07 18:12:53 +01:00
d68e836b57 trans: add various english translations 2025-11-07 18:12:37 +01:00
fe77f1da8d trans: add many translations 2025-11-07 17:08:13 +01:00
78b71690c0 feat: Allow toggling ongoing communication status 2025-11-07 14:02:22 +01:00
3b9ee95abc feat: Add log export functionality 2025-11-07 14:01:51 +01:00
b4e50364de fix: dependency 2025-11-03 22:22:22 +01:00
b014b3b227 fix: quotes 2025-11-03 22:22:12 +01:00
99bfe460ee fix: remove debug statement 2025-11-03 18:24:45 +01:00
d4c7caa42d fix: allow empty internal IP 2025-11-03 18:24:20 +01:00
32c8fc88cf feat: add debug command that prints settings 2025-11-03 18:22:11 +01:00
151ce0d88e fix: massively reduce number of db queries by caching num_per_sex #27
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-11-03 17:00:16 +01:00
e07e633651 style: explicitly return none 2025-11-03 16:53:59 +01:00
dd3b1fde9d feat: Add logs for checking rescue orgs and remove deprecated exclusion 2025-11-03 16:15:11 +01:00
2ffc9b4ba1 feat: Ad django debug toolbar 2025-11-03 16:14:51 +01:00
22eebd4586 feat: Add simple profiler capability 2025-11-03 16:14:05 +01:00
e589a048d3 feat: Make logs in Admin more usable 2025-11-03 16:11:48 +01:00
392eb5a7a8 feat: Use unified explanation for reason for signup 2025-11-02 08:15:11 +01:00
44fa4d4880 feat: Remove requirement to retype password 2025-11-02 08:14:41 +01:00
9b97cc4cb1 fix: Ensure javascript for login is loaded 2025-11-02 08:14:03 +01:00
656a24ef02 feat: Make settings configurable
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-10-21 03:37:36 +02:00
74643db087 feat: Add nicer display of passkeys based on panels 2025-10-21 03:27:08 +02:00
3a6fd3cee1 feat: Add nicer badge 2025-10-21 03:24:19 +02:00
29e9d1bd8c feat: Don't make input for radio button 2025-10-21 03:24:07 +02:00
3c5ca9ae00 feat: Fix display of 2fa options 2025-10-21 02:12:34 +02:00
3d1ad6112d feat: Add link to 2fa options 2025-10-21 02:12:17 +02:00
b843e67e9b feat: put buttons in group 2025-10-21 01:47:17 +02:00
4cab71e8fb feat: Style allauth templates 2025-10-21 01:28:31 +02:00
969339a95f feat: Use allauth and add passkey support 2025-10-21 00:40:10 +02:00
e06efa1539 feat: limit to 10 2025-10-21 14:47:13 +02:00
2fb6d2782f fix: Align button description with function 2025-10-20 21:56:04 +02:00
f69eccd0e4 feat: add page for updating the exclusion reason where it's not set yet 2025-10-20 18:33:15 +02:00
e20e6d4b1d fix: typo 2025-10-20 18:31:10 +02:00
0352a60e28 feat: Add reason why rescue org was excluded from check
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-10-20 10:54:23 +02:00
abeb14601a docs: Add general explenation 2025-10-20 10:12:40 +02:00
f52225495d docs: Add number of rescueorgs in table 2025-10-20 10:09:58 +02:00
797b2c15f7 docs: Add adoption notice lifecycle
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-10-19 22:53:29 +02:00
e81618500b docs: Add getting started
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-10-19 21:02:51 +02:00
f7a5da306c docs: Add details to notifications 2025-10-19 21:02:33 +02:00
92a9b5c6c9 fix: typo 2025-10-19 17:46:47 +02:00
964aeb97a7 docs: documentation on checking rescue orgs
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
2025-10-19 09:41:19 +02:00
474e9eb0f8 feat: Add extension to sphinx that includes drawio diagrams 2025-10-19 09:40:51 +02:00
7acc2c6eec feat: Document shortcuts in org-check und documentation 2025-10-19 08:35:19 +02:00
5a02837d7f feat: Fix age display and test 2025-10-18 18:45:17 +02:00
7ff0a9b489 feat: Add stats 2025-10-03 18:37:54 +02:00
9af4b58a4f feat: Add stats 2025-10-03 09:39:48 +02:00
7a20890f17 feat: Add organization to form 2025-10-01 06:13:01 +02:00
f6c9e532f8 feat: Use status-specific description 2025-10-01 05:58:30 +02:00
f1698c4fd3 fix: use correct new status 2025-10-01 05:54:43 +02:00
cb82aeffde fix: use correct new status 2025-10-01 05:33:49 +02:00
e9c1ef2604 feat: typo 2025-09-29 17:34:46 +02:00
d8f0f2b3be feat: Use status description to more accuratly describe status 2025-09-29 17:34:38 +02:00
65f065f5ce feat: Move unchecked to awaiting action 2025-09-29 17:34:13 +02:00
5cba64e500 feat: allow links to break anywhere 2025-09-29 17:32:05 +02:00
064784a222 feat: Use contact data of parent org if org doesn't have specified 2025-09-27 15:35:39 +02:00
b890ef3563 fix: Use block only when description exists 2025-09-27 15:34:32 +02:00
962f2ae86c feat: Add contact site 2025-09-17 20:02:20 +02:00
c71a1940dd feat: Add url of adoption notice to API 2025-09-17 20:02:13 +02:00
8b2913a8be feat: Add Image width and height to API 2025-09-16 16:38:29 +02:00
111ffc2b2e feat: Add Image alt text to API 2025-09-13 16:53:13 +02:00
600aa918ef feat: Add Image URL to API 2025-09-13 16:49:00 +02:00
68e13ed176 feat: Add API to get adoption notices of organization 2025-09-13 16:05:49 +02:00
0fa4330f2c feat: Add more clear when no Adoption notice is found 2025-09-10 23:29:56 +02:00
c9289b1e8c feat: Add padding to iframe content 2025-09-10 23:29:30 +02:00
bb3136bfc7 feat: Allow setting a background color for embedding 2025-09-10 22:54:24 +02:00
b708e9ecaf feat: Get all adoption notices in hierarchy 2025-09-10 20:18:10 +02:00
f3619b2881 fix: Exclude embeddable from xframe options 2025-09-10 19:28:36 +02:00
7572c92da5 feat: Add expand option 2025-09-10 19:28:19 +02:00
5a2b11b44e feat: Add basic embeddable view for ans of rescue orgs 2025-09-10 17:44:33 +02:00
df15ea100b feat: Add stub to translate ANs to sharepics 2025-09-10 13:17:50 +02:00
3da6e90f73 feat: Show short description for ANs with one picture 2025-09-07 20:36:41 +02:00
f784ab0c78 feat: Restyle the image upload 2025-09-06 16:06:12 +02:00
ebaa477cff feat: Use slug to get specialization 2025-09-06 15:35:17 +02:00
b4be21bf45 feat: Add slug to species 2025-09-06 15:14:04 +02:00
0df36df9d8 fix: has search criteria had twisted logic 2025-09-06 14:08:30 +02:00
a5754b2633 feat: Optimize search for larger number of ANs 2025-09-06 13:35:19 +02:00
7c6e01a436 feat: Add various verbose names and helptexts 2025-09-06 13:12:06 +02:00
ad90429ec7 feat: Add local db backups to gitignore 2025-09-05 16:19:13 +02:00
0e36237890 feat: Add adoption notice template for contacting a person directly 2025-09-05 16:07:21 +02:00
3261f5a90a fix: Allow to actually close AN 2025-09-03 06:43:12 +02:00
1551c1bdf2 fix: correctly filter for adoption notices 2025-09-03 06:28:35 +02:00
996bd7af67 feat: Re-style comment field to be inside comment box 2025-09-03 06:28:13 +02:00
21bd34c94d feat: Add divider 2025-09-03 06:27:48 +02:00
fb581c940b fix: fix action menu hidden behind animal 2025-09-01 21:57:59 +02:00
b428f46213 fix: unify 2025-08-31 23:21:56 +02:00
38fe55dd86 fix: Only post to fedi if there is a adoption notice to post 2025-08-31 22:05:26 +02:00
0da6c425fd feat: Add link to oxitraffic 2025-08-31 22:04:12 +02:00
81962ab9e7 fix: Make sure tasks are only executed once per hour 2025-08-31 20:41:10 +02:00
48dd0a6a19 fix: Add a block 2025-08-31 20:34:48 +02:00
661827a957 chore: Bump 1.2.1 2025-08-31 18:05:29 +02:00
242de5f749 fix: filter for active adoption notices 2025-08-31 18:05:02 +02:00
bd7f940987 chore: Bump version to 1.2.0 2025-08-31 17:07:03 +02:00
0634671c84 feat: Style further information more clearly 2025-08-31 17:06:01 +02:00
1fb5be0cf8 feat: Add description of adoption process 2025-08-31 17:04:08 +02:00
3f9e4265e5 refactor: move descriptions to dedicated mapping 2025-08-31 16:18:49 +02:00
de21b8b5e5 refactor: remove unused imports 2025-08-31 10:54:48 +02:00
fd481fef2e feat: Fully replace the Adoption Notice Status model with the field 2025-08-31 10:52:48 +02:00
70f077e393 feat: Add general field-based status and migrate data 2025-08-31 00:28:44 +02:00
1c7d943a21 feat: Add image preview for uploading new images 2025-08-29 08:47:34 +02:00
41873ebfe5 fix: Send actually new user notification 2025-08-12 17:17:35 +02:00
fc2dbde064 feat: make 20km default 2025-08-12 06:28:03 +02:00
122 changed files with 5916 additions and 2012 deletions

1
.gitignore vendored
View File

@@ -2,6 +2,7 @@
# Database # Database
notfellchen notfellchen
*.sq3
# Geojson from imports # Geojson from imports
*.geojson *.geojson

View File

@@ -9,15 +9,14 @@ RUN apt install gettext -y
RUN apt install libpq-dev gcc -y RUN apt install libpq-dev gcc -y
COPY . /app COPY . /app
WORKDIR /app WORKDIR /app
RUN mkdir /app/data RUN mkdir /app/data/static -p
RUN mkdir /app/data/static
RUN mkdir /app/data/media RUN mkdir /app/data/media
RUN pip install -e . # Without the -e the library static folder will not be copied by collectstatic! RUN pip install --no-cache-dir -e . # Without the -e the library static folder will not be copied by collectstatic!
RUN nf collectstatic --noinput RUN nf collectstatic --noinput
RUN nf compilemessages --ignore venv RUN nf compilemessages --ignore venv
COPY docker/notfellchen.bash /bin/notfellchen COPY docker/entrypoint.sh /bin/notfellchen
EXPOSE 7345 EXPOSE 7345
CMD ["notfellchen"] CMD ["notfellchen"]

74
docs/_ext/drawio.py Normal file
View File

@@ -0,0 +1,74 @@
from __future__ import annotations
from pathlib import Path
from docutils import nodes
from sphinx.application import Sphinx
from sphinx.util.docutils import SphinxDirective
from sphinx.util.typing import ExtensionMetadata
class DrawioDirective(SphinxDirective):
"""A directive to show a drawio diagram!
Usage:
.. drawio::
example-diagram.drawio.html
example-diagram.drawio.png
:alt: Example of a Draw.io diagram
"""
has_content = False
required_arguments = 2 # html and png
optional_arguments = 1
final_argument_whitespace = True # indicating if the final argument may contain whitespace
option_spec = {
"alt": str,
}
def run(self) -> list[nodes.Node]:
env = self.state.document.settings.env
builder = env.app.builder
# Resolve paths relative to the document
docdir = Path(env.doc2path(env.docname)).parent
html_rel = Path(self.arguments[0])
png_rel = Path(self.arguments[1])
html_path = (docdir / html_rel).resolve()
png_path = (docdir / png_rel).resolve()
alt_text = self.options.get("alt", "")
container = nodes.container()
# HTML output -> raw HTML node
if builder.format == "html":
# Embed the HTML file contents directly
try:
html_content = html_path.read_text(encoding="utf-8")
except OSError as e:
msg = self.state_machine.reporter.error(f"Cannot read HTML file: {e}")
return [msg]
aria_attribute = f' aria-label="{alt_text}"' if alt_text else ""
raw_html_node = nodes.raw(
"",
f'<div class="drawio-diagram"{aria_attribute}>{html_content}</div>',
format="html",
)
container += raw_html_node
else:
# Other outputs -> PNG image node
image_node = nodes.image(uri=png_path)
container += image_node
return [container]
def setup(app: Sphinx) -> ExtensionMetadata:
app.add_directive("drawio", DrawioDirective)
return {
"version": "0.2",
"parallel_read_safe": True,
"parallel_write_safe": True,
}

View File

@@ -16,6 +16,10 @@
# import sys # import sys
# sys.path.insert(0, os.path.abspath('.')) # sys.path.insert(0, os.path.abspath('.'))
import sys
from pathlib import Path
sys.path.append(str(Path('_ext').resolve()))
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
@@ -28,7 +32,6 @@ version = ''
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags
release = '0.2.0' release = '0.2.0'
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here. # If your documentation needs a minimal Sphinx version, state it here.
@@ -40,6 +43,7 @@ release = '0.2.0'
# ones. # ones.
extensions = [ extensions = [
'sphinx.ext.ifconfig', 'sphinx.ext.ifconfig',
'drawio'
] ]
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
@@ -69,7 +73,6 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use. # The name of the Pygments (syntax highlighting) style to use.
pygments_style = None pygments_style = None
# -- Options for HTML output ------------------------------------------------- # -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
@@ -104,7 +107,6 @@ html_static_path = ['_static']
# Output file base name for HTML help builder. # Output file base name for HTML help builder.
htmlhelp_basename = 'notfellchen' htmlhelp_basename = 'notfellchen'
# -- Options for LaTeX output ------------------------------------------------ # -- Options for LaTeX output ------------------------------------------------
latex_elements = { latex_elements = {
@@ -133,7 +135,6 @@ latex_documents = [
'Julian-Samuel Gebühr', 'manual'), 'Julian-Samuel Gebühr', 'manual'),
] ]
# -- Options for manual page output ------------------------------------------ # -- Options for manual page output ------------------------------------------
# One entry per manual page. List of tuples # One entry per manual page. List of tuples
@@ -143,7 +144,6 @@ man_pages = [
[author], 1) [author], 1)
] ]
# -- Options for Texinfo output ---------------------------------------------- # -- Options for Texinfo output ----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples # Grouping the document tree into Texinfo files. List of tuples
@@ -155,7 +155,6 @@ texinfo_documents = [
'Miscellaneous'), 'Miscellaneous'),
] ]
# -- Options for Epub output ------------------------------------------------- # -- Options for Epub output -------------------------------------------------
# Bibliographic Dublin Core info. # Bibliographic Dublin Core info.
@@ -173,5 +172,4 @@ epub_title = project
# A list of files that should not be packed into the epub file. # A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html'] epub_exclude_files = ['search.html']
# -- Extension configuration ------------------------------------------------- # -- Extension configuration -------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

File diff suppressed because one or more lines are too long

View File

@@ -6,14 +6,27 @@ Jede Vermittlung kann abonniert werden. Dafür klickst du auf die Glocke neben d
.. image:: abonnieren.png .. image:: abonnieren.png
Einstellungen
-------------
Du kannst E-Mail Benachrichtigungen in den Einstellungen deaktivieren.
.. image::
einstellungen-benachrichtigungen.png
:alt: Screenshot der Profileinstellungen in Notfellchen. Ein roter Pfeil zeigt auf einen Schalter "E-Mail Benachrichtigungen"
Auf der Website Auf der Website
+++++++++++++++ +++++++++++++++
.. image::
screenshot-benachrichtigungen.png
:alt: Screenshot der Menüleiste von Notfellchen.org. Neben dem Symbol einer Glocke steht die Zahl 27.
E-Mail E-Mail
++++++ ++++++
Mit während deiner :doc:`registrierung` gibst du eine E-Mail Addresse an. Mit während deiner :doc:`registrierung` gibst du eine E-Mail Adresse an. An diese senden wir Benachrichtigungen, außer
du deaktiviert dies wie oben beschrieben.
Benachrichtigungen senden wir per Mail - du kannst das jederzeit in den Einstellungen deaktivieren.

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@@ -0,0 +1,58 @@
Erste Schritte
==============
Tiere zum Adoptieren suchen
---------------------------
Wenn du Tiere zum adoptieren suchst, brauchst du keinen Account. Du kannst bequem die `Suche <https://notfellchen.org/suchen/>`_ nutzen, um Tiere zur Adoption in deiner Nähe zu finden.
Wenn dich eine Vermittlung interessiert, kannst du folgendes tun
* die Vermittlung aufrufen um Details zu sehen
* den Link :guilabel:`Weitere Informationen` anklicken um auf der Tierheimwebsite mehr zu erfahren
* per Kommentar weitere Informationen erfragen oder hinzufügen
Wenn du die Tiere tatsächlich informieren willst, folge der Anleitung unter :guilabel:`Adoptionsprozess`.
Dieser kann sich je nach Tierschutzorganisation unterscheiden.
.. image::
screenshot-adoptionsprozess.png
:alt: Screenshot der Sektion "Adoptionsprozess" einer Vermittlungsanzeige. Der Prozess ist folgendermaßen: 1. Link zu "Weiteren Informationen" prüfen, 2. Organization kontaktieren, 3. Bei erfolgreicher Vermittlung: Vermittlung als geschlossen melden
Suchen abonnieren
+++++++++++++++++
Es kann sein, dass es in deiner Umgebung keine passenden Tiere für deine Suche gibt. Damit du nicht ständig wieder Suchen musst, gibt es die Funktion "Suche abonnieren".
Wenn du eine Suche abonnierst, wirst du für neue Vermittlungen, die den Kriterien der Suche entsprechen, benachrichtigt.
.. image::
screenshot-suche-abonnieren.png
:alt: Screenshot der Suchmaske auf Notfellchen.org . Ein roter Pfeil zeigt auf den Button "Suche abonnieren"
.. important::
Um Suchen zu abonnieren brauchst du einen Account. Wie du einen Account erstellst erfährst du hier: :doc:`registrierung`.
.. hint::
Mehr über Benachrichtigungen findest du hier: :doc:`benachrichtigungen`.
Vermittlungen hinzufügen
------------------------
Gehe zu `Vermittlung hinzufügen <https://notfellchen.org/vermitteln/>`_ um eine neue Vermittlung einzustellen.
Füge alle Informationen die du hast hinzu.
.. important::
Um Vermittlungen hinzuzufügen brauchst du einen Account.
Wie du einen Account erstellst erfährst du hier: :doc:`registrierung`.
.. important::
Vermittlungen die du einstellst müssen erst durch Moderator\*innen freigeschaltet werden. Das passiert normalerweise
innerhalb von 24 Stunden. Wenn deine Vermittlung dann noch nicht freigeschaltet ist, prüfe bitte dein E-Mail Postfach,
es könnte sein, dass die Moderator\*innen Rückfragen haben. Melde dich gerne unter info@notfellchen.org, wenn deine
Vermittlung nach 24 Stunden nicht freigeschaltet ist.

View File

@@ -1,11 +1,17 @@
****************** ****************
User Dokumentation Benutzerhandbuch
****************** ****************
Im Benutzerhandbuch findest du Informationen zur Benutzung von `notfellchen.org <https://notfellchen.org>`_.
Solltest du darüber hinaus Fragen haben, komm gerne auf uns zu: info@notfellchen.org
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
:caption: Inhalt: :caption: Inhalt:
erste-schritte.rst
registrierung.rst registrierung.rst
vermittlungen.rst vermittlungen.rst
moderationskonzept.rst moderationskonzept.rst
benachrichtigungen.rst benachrichtigungen.rst
organisationen-pruefen.rst

View File

@@ -0,0 +1,55 @@
Tiere in Vermittlung systematisch entdecken & eintragen
=======================================================
Notfellchen hat eine Liste der meisten deutschen Tierheime und anderer Tierschutzorganisationen.
Die meisten dieser Organisationen nehmen Tiere auf die bei Notfellchen eingetragen werden können.
Es ist daher das Ziel, diese Organisationen alle zwei Wochen auf neue Tiere zu prüfen.
+-------------------------------------------------+---------+----------------------+
| Gruppe | Anzahl | Zuletzt aktualisiert |
+=================================================+=========+======================+
| Tierschutzorganisationen im Verzeichnis | 550 | Oktober 2025 |
+-------------------------------------------------+---------+----------------------+
| Tierschutzorganisationen in regelmäßigerPrüfung | 412 | Oktober 2025 |
+-------------------------------------------------+---------+----------------------+
.. warning::
Organisationen auf neue Tiere zu prüfen ist eine Funktion für Moderator\*innen. Falls du Lust hast mitzuhelfen,
meld dich unter info@notfellchen.org
Als Moderator\*in kannst du direkt auf den `Moderations-Check <https://notfellchen.org/organization-check/>`_ zugreifen
oder findest ihn in unter :menuselection:`Hilfreiche Links --> Moderationstools`:
.. image::
Screenshot-hilfreiche-Links.png
:alt: Screenshot der Hilfreichen Links. Zur Auswahl stehen "Tierheime in der Nähe","Moderationstools" und "Admin-Bereich"
.. image::
Screenshot-Moderationstools.png
:alt: Screenshot der Moderationstools. Zur Auswahl stehen "Moderationswarteschlange", "Up-to-Date Check", "Organisations-Check" und "Vermittlung ins Fediverse posten".
Arbeitsmodus
------------
.. drawio::
Tiere-in-Vermittlung-entdecken.drawio.html
Tiere-in-Vermittlung-entdecken.drawio.png
Shortcuts
---------
Um die Prüfung schneller zu gestalten, gibt es eine Reihe von Shortcuts die du nutzen kannst. Aus Gründen der
Übersichtlichkeit sind im Folgenden auch Shortcuts im Browser aufgeführt.
+------------------------------------------------------+---------------+
| Aktion | Shortcut |
+======================================================+===============+
| Website der ersten Tierschutzorganisation öffnen | :kbd:`O` |
+------------------------------------------------------+---------------+
| Tab schließen (Firefox/Chrome) | :kbd:`STRG+W` |
+------------------------------------------------------+---------------+
| Erste Tierschutzorganisationa als geprüft markieren | :kbd:`C` |
+------------------------------------------------------+---------------+

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -1,7 +1,7 @@
Vermittlungen Vermittlungen
============= =============
Vermittlungen können von allen Nutzer*innen mit Account erstellt werden. Vermittlungen normaler Nutzer*innen kommen dann in eine Warteschlange und werden vom Admin & Modertionsteam geprüft und sichtbar geschaltet. Vermittlungen können von allen Nutzer\*innen mit Account erstellt werden. Vermittlungen normaler Nutzer*innen kommen dann in eine Warteschlange und werden vom Admin & Modertionsteam geprüft und sichtbar geschaltet.
Tierheime und Pflegestellen können auf Anfrage einen Koordinations-Status bekommen, wodurch sie Vermittlungsanzeigen erstellen können die direkt öffentlich sichtbar sind. Tierheime und Pflegestellen können auf Anfrage einen Koordinations-Status bekommen, wodurch sie Vermittlungsanzeigen erstellen können die direkt öffentlich sichtbar sind.
Jede Vermittlung hat ein "Zuletzt-geprüft" Datum, das anzeigt, wann ein Mensch zuletzt überprüft hat, ob die Anzeige noch aktuell ist. Jede Vermittlung hat ein "Zuletzt-geprüft" Datum, das anzeigt, wann ein Mensch zuletzt überprüft hat, ob die Anzeige noch aktuell ist.
@@ -15,3 +15,114 @@ Die Kommentarfunktion von Vermittlungen ermöglicht es angemeldeten Nutzer*innen
Ersteller*innen von Vermittlungen werden über neue Kommentare per Mail benachrichtigt, ebenso alle die die Vermittlung abonniert haben. Ersteller*innen von Vermittlungen werden über neue Kommentare per Mail benachrichtigt, ebenso alle die die Vermittlung abonniert haben.
Kommentare können, wie Vermittlungen, gemeldet werden. Kommentare können, wie Vermittlungen, gemeldet werden.
.. drawio::
Vermittlung_Lifecycle.drawio.html
Vermittlung-Lifecycle.drawio.png
:alt: Diagramm das den Prozess der Vermittlungen zeigt.
Adoption Notice Status Choices
++++++++++++++++++++++++++++++
Aktiv
-----
Aktive Vermittlungen die über die Suche auffindbar sind.
.. list-table::
:header-rows: 1
:width: 100%
:widths: 1 1 2
* - Value
- Label
- Description
* - ``active_searching``
- Searching
-
* - ``active_interested``
- Interested
- Jemand hat bereits Interesse an den Tieren.
Warte auf Aktion
----------------
Vermittlungen in diesem Status warten darauf, dass ein Mensch sie überprüft. Sie können nicht über die Suche gefunden werden.
.. list-table::
:header-rows: 1
:width: 100%
:widths: 1 1 2
* - ``awaiting_action_waiting_for_review``
- Waiting for review
- Neue Vermittlung die deaktiviert ist bis Moderator*innen sie überprüfen.
* - ``awaiting_action_needs_additional_info``
- Needs additional info
- Deaktiviert bis Informationen nachgetragen werden.
* - ``disabled_unchecked``
- Unchecked
- Vermittlung deaktiviert bis sie vom Team auf Aktualität geprüft wurde.
Geschlossen
-----------
Geschlossene Vermittlungen tauchen in keiner Suche auf. Sie werden aber weiterhin angezeigt, wenn der Link zu ihnen direkt aufgerufen wird.
.. list-table::
:header-rows: 1
:width: 100%
:widths: 1 1 2
* - ``closed_successful_with_notfellchen``
- Successful (with Notfellchen)
- Vermittlung erfolgreich abgeschlossen.
* - ``closed_successful_without_notfellchen``
- Successful (without Notfellchen)
- Vermittlung erfolgreich abgeschlossen.
* - ``closed_animal_died``
- Animal died
- Die zu vermittelnden Tiere sind über die Regenbrücke gegangen.
* - ``closed_for_other_adoption_notice``
- Closed for other adoption notice
- Vermittlung wurde zugunsten einer anderen geschlossen.
* - ``closed_not_open_for_adoption_anymore``
- Not open for adoption anymore
- Tier(e) stehen nicht mehr zur Vermittlung bereit.
* - ``closed_link_to_more_info_not_reachable``
- Der Link zu weiteren Informationen ist nicht mehr erreichbar.
- Der Link zu weiteren Informationen ist nicht mehr erreichbar, die Vermittlung wurde daher automatisch deaktiviert.
* - ``closed_other``
- Other (closed)
- Vermittlung geschlossen.
Deaktiviert
-----------
Deaktivierte Vermittlungen werden nur noch Moderator\*innen und Administrator\*innen angezeigt.
.. list-table::
:header-rows: 1
:width: 100%
:widths: 1 1 2
* - ``disabled_against_the_rules``
- Against the rules
- Vermittlung deaktiviert da sie gegen die Regeln verstößt.
* - ``disabled_other``
- Other (disabled)
- Vermittlung deaktiviert.

View File

@@ -8,6 +8,8 @@ host=localhost
[django] [django]
secret=CHANGE-ME secret=CHANGE-ME
debug=True debug=True
internal_ips=["127.0.0.1"]
cache=False
[database] [database]
backend=sqlite3 backend=sqlite3
@@ -28,3 +30,6 @@ django_log_level=INFO
api_url=https://photon.hyteck.de/api api_url=https://photon.hyteck.de/api
api_format=photon api_format=photon
[security]
totp_issuer="NF Localhost"
webauth_allow_insecure_origin=True

View File

@@ -38,7 +38,10 @@ dependencies = [
"celery[redis]", "celery[redis]",
"drf-spectacular[sidecar]", "drf-spectacular[sidecar]",
"django-widget-tweaks", "django-widget-tweaks",
"django-super-deduper" "django-super-deduper",
"django-allauth[mfa]",
"django_debug_toolbar",
"django-admin-extra-buttons"
] ]
dynamic = ["version", "readme"] dynamic = ["version", "readme"]

View File

@@ -205,6 +205,8 @@ def main():
h = {'Authorization': f'Token {api_token}', "content-type": "application/json"} h = {'Authorization': f'Token {api_token}', "content-type": "application/json"}
tierheime = overpass_result["features"] tierheime = overpass_result["features"]
stats = {"num_updated_orgs": 0,
"num_inserted_orgs": 0}
for idx, tierheim in enumerate(tqdm(tierheime)): for idx, tierheim in enumerate(tqdm(tierheime)):
# Check if data is low quality # Check if data is low quality
@@ -229,11 +231,13 @@ def main():
optional_data = ["email", "phone_number", "website", "description", "fediverse_profile", "facebook", optional_data = ["email", "phone_number", "website", "description", "fediverse_profile", "facebook",
"instagram"] "instagram"]
# Check if rescue organization exits # Check if rescue organization exists
search_data = {"external_source_identifier": "OSM", search_data = {"external_source_identifier": "OSM",
"external_object_identifier": f"{tierheim["id"]}"} "external_object_identifier": f"{tierheim["id"]}"}
search_result = requests.get(f"{instance}/api/organizations", params=search_data, headers=h) search_result = requests.get(f"{instance}/api/organizations", params=search_data, headers=h)
# Rescue organization exits
if search_result.status_code == 200: if search_result.status_code == 200:
stats["num_updated_orgs"] += 1
org_id = search_result.json()[0]["id"] org_id = search_result.json()[0]["id"]
logging.debug(f"{th_data.name} already exists as ID {org_id}.") logging.debug(f"{th_data.name} already exists as ID {org_id}.")
org_patch_data = {"id": org_id, org_patch_data = {"id": org_id,
@@ -248,7 +252,9 @@ def main():
if result.status_code != 200: if result.status_code != 200:
logging.warning(f"Updating {tierheim['properties']['name']} failed:{result.status_code} {result.json()}") logging.warning(f"Updating {tierheim['properties']['name']} failed:{result.status_code} {result.json()}")
continue continue
# Rescue organization does not exist
else: else:
stats["num_inserted_orgs"] += 1
location = create_location(tierheim, instance, h) location = create_location(tierheim, instance, h)
org_data = {"name": tierheim["properties"]["name"], org_data = {"name": tierheim["properties"]["name"],
"external_object_identifier": f"{tierheim["id"]}", "external_object_identifier": f"{tierheim["id"]}",
@@ -262,6 +268,7 @@ def main():
if result.status_code != 201: if result.status_code != 201:
print(f"{idx} {tierheim["properties"]["name"]}:{result.status_code} {result.json()}") print(f"{idx} {tierheim["properties"]["name"]}:{result.status_code} {result.json()}")
print(f"Upload finished. Inserted {stats['num_inserted_orgs']} new orgs and updated {stats['num_updated_orgs']} orgs.")
if __name__ == "__main__": if __name__ == "__main__":

View File

@@ -7,30 +7,43 @@ from django.utils.html import format_html
from django.urls import reverse from django.urls import reverse
from django.utils.http import urlencode from django.utils.http import urlencode
from .models import User, Language, Text, ReportComment, ReportAdoptionNotice, Log, Timestamp, SearchSubscription, \ from admin_extra_buttons.api import ExtraButtonsMixin, button, link
from .models import Language, Text, ReportComment, ReportAdoptionNotice, Log, Timestamp, SearchSubscription, \
SpeciesSpecificURL, ImportantLocation, SocialMediaPost SpeciesSpecificURL, ImportantLocation, SocialMediaPost
from .models import Animal, Species, RescueOrganization, AdoptionNotice, Location, Rule, Image, ModerationAction, \ from .models import Animal, Species, RescueOrganization, AdoptionNotice, Location, Rule, Image, ModerationAction, \
Comment, Report, Announcement, AdoptionNoticeStatus, User, Subscriptions, Notification Comment, Announcement, User, Subscriptions, Notification
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from .tools.model_helpers import AdoptionNoticeStatusChoices
class StatusInline(admin.StackedInline):
model = AdoptionNoticeStatus def export_to_csv_generic(model, queryset):
meta = model._meta
field_names = [field.name for field in meta.fields]
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename={}.csv'.format(meta)
writer = csv.writer(response)
writer.writerow(field_names)
for obj in queryset:
row = writer.writerow([getattr(obj, field) for field in field_names])
return response
@admin.register(AdoptionNotice) @admin.register(AdoptionNotice)
class AdoptionNoticeAdmin(admin.ModelAdmin): class AdoptionNoticeAdmin(admin.ModelAdmin):
search_fields = ("name__icontains", "description__icontains") search_fields = ("name__icontains", "description__icontains")
list_filter = ("owner",) list_filter = ("owner",)
inlines = [
StatusInline,
]
actions = ("activate",) actions = ("activate",)
def activate(self, request, queryset): def activate(self, request, queryset):
for obj in queryset: for obj in queryset:
obj.set_active() obj.adoption_notice_status = AdoptionNoticeStatusChoices.Active.SEARCHING
obj.save()
activate.short_description = _("Ausgewählte Vermittlungen aktivieren") activate.short_description = _("Ausgewählte Vermittlungen aktivieren")
@@ -53,17 +66,7 @@ class UserAdmin(admin.ModelAdmin):
return format_html('<a href="{}">{} Adoption Notices</a>', url, count) return format_html('<a href="{}">{} Adoption Notices</a>', url, count)
def export_as_csv(self, request, queryset): def export_as_csv(self, request, queryset):
meta = self.model._meta response = export_to_csv_generic(self.model, queryset)
field_names = [field.name for field in meta.fields]
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename={}.csv'.format(meta)
writer = csv.writer(response)
writer.writerow(field_names)
for obj in queryset:
row = writer.writerow([getattr(obj, field) for field in field_names])
return response return response
export_as_csv.short_description = _("Ausgewählte User exportieren") export_as_csv.short_description = _("Ausgewählte User exportieren")
@@ -162,10 +165,34 @@ class LocationAdmin(admin.ModelAdmin):
ImportantLocationInline, ImportantLocationInline,
] ]
@admin.register(SocialMediaPost) @admin.register(SocialMediaPost)
class SocialMediaPostAdmin(admin.ModelAdmin): class SocialMediaPostAdmin(admin.ModelAdmin):
list_filter = ("platform",) list_filter = ("platform",)
@admin.register(Log)
class LogAdmin(ExtraButtonsMixin, admin.ModelAdmin):
ordering = ["-created_at"]
list_filter = ("action",)
list_display = ("action", "user", "created_at")
actions = ("export_as_csv",)
@admin.action(description=_("Ausgewählte Logs exportieren"))
def export_as_csv(self, request, queryset):
response = export_to_csv_generic(Log, queryset)
return response
@button()
def export_all_as_csv(self, request):
actual_queryset = Log.objects.all()
response = export_to_csv_generic(Log, actual_queryset)
return response
@link(href="https://www.google.com/", visible=lambda btn: True)
def invisible(self, button):
button.visible = False
admin.site.register(Animal) admin.site.register(Animal)
admin.site.register(Species) admin.site.register(Species)
admin.site.register(Rule) admin.site.register(Rule)
@@ -173,7 +200,5 @@ admin.site.register(Image)
admin.site.register(ModerationAction) admin.site.register(ModerationAction)
admin.site.register(Language) admin.site.register(Language)
admin.site.register(Announcement) admin.site.register(Announcement)
admin.site.register(AdoptionNoticeStatus)
admin.site.register(Subscriptions) admin.site.register(Subscriptions)
admin.site.register(Log)
admin.site.register(Timestamp) admin.site.register(Timestamp)

View File

@@ -3,6 +3,21 @@ from rest_framework import serializers
import math import math
class ImageSerializer(serializers.ModelSerializer):
width = serializers.SerializerMethodField()
height = serializers.SerializerMethodField()
class Meta:
model = Image
fields = ['id', 'image', 'alt_text', 'width', 'height']
def get_width(self, obj):
return obj.image.width
def get_height(self, obj):
return obj.image.height
class AdoptionNoticeSerializer(serializers.HyperlinkedModelSerializer): class AdoptionNoticeSerializer(serializers.HyperlinkedModelSerializer):
location = serializers.PrimaryKeyRelatedField( location = serializers.PrimaryKeyRelatedField(
queryset=Location.objects.all(), queryset=Location.objects.all(),
@@ -20,17 +35,18 @@ class AdoptionNoticeSerializer(serializers.HyperlinkedModelSerializer):
required=False, required=False,
allow_null=True allow_null=True
) )
url = serializers.SerializerMethodField()
photos = serializers.PrimaryKeyRelatedField( photos = ImageSerializer(many=True, read_only=True)
queryset=Image.objects.all(),
many=True, def get_url(self, obj):
required=False return obj.get_full_url()
)
class Meta: class Meta:
model = AdoptionNotice model = AdoptionNotice
fields = ['created_at', 'last_checked', "searching_since", "name", "description", "further_information", fields = ['created_at', 'last_checked', "searching_since", "name", "description", "further_information",
"group_only", "location", "location_details", "organization", "photos"] "group_only", "location", "location_details", "organization", "photos", "adoption_notice_status",
"url"]
class AdoptionNoticeGeoJSONSerializer(serializers.ModelSerializer): class AdoptionNoticeGeoJSONSerializer(serializers.ModelSerializer):

View File

@@ -2,7 +2,7 @@ from django.urls import path
from .views import ( from .views import (
AdoptionNoticeApiView, AdoptionNoticeApiView,
AnimalApiView, RescueOrganizationApiView, AddImageApiView, SpeciesApiView, LocationApiView, AnimalApiView, RescueOrganizationApiView, AddImageApiView, SpeciesApiView, LocationApiView,
AdoptionNoticeGeoJSONView, RescueOrgGeoJSONView AdoptionNoticeGeoJSONView, RescueOrgGeoJSONView, AdoptionNoticePerOrgApiView
) )
urlpatterns = [ urlpatterns = [
@@ -14,6 +14,7 @@ urlpatterns = [
path("organizations/", RescueOrganizationApiView.as_view(), name="api-organization-list"), path("organizations/", RescueOrganizationApiView.as_view(), name="api-organization-list"),
path("organizations.geojson", RescueOrgGeoJSONView.as_view(), name="api-organization-list-geojson"), path("organizations.geojson", RescueOrgGeoJSONView.as_view(), name="api-organization-list-geojson"),
path("organizations/<int:id>/", RescueOrganizationApiView.as_view(), name="api-organization-detail"), path("organizations/<int:id>/", RescueOrganizationApiView.as_view(), name="api-organization-detail"),
path("organizations/<int:id>/adoption-notices", AdoptionNoticePerOrgApiView.as_view(), name="api-organization-adoption-notices"),
path("images/", AddImageApiView.as_view(), name="api-add-image"), path("images/", AddImageApiView.as_view(), name="api-add-image"),
path("species/", SpeciesApiView.as_view(), name="api-species-list"), path("species/", SpeciesApiView.as_view(), name="api-species-list"),
path("locations/", LocationApiView.as_view(), name="api-locations-list"), path("locations/", LocationApiView.as_view(), name="api-locations-list"),

View File

@@ -1,11 +1,12 @@
from django.db.models import Q from django.db.models import Q
from drf_spectacular.types import OpenApiTypes
from rest_framework.generics import ListAPIView from rest_framework.generics import ListAPIView
from fellchensammlung.api.serializers import LocationSerializer, AdoptionNoticeGeoJSONSerializer from fellchensammlung.api.serializers import LocationSerializer, AdoptionNoticeGeoJSONSerializer
from rest_framework.views import APIView from rest_framework.views import APIView
from rest_framework.response import Response from rest_framework.response import Response
from django.db import transaction from django.db import transaction
from fellchensammlung.models import AdoptionNotice, Animal, Log, TrustLevel, Location, AdoptionNoticeStatus from fellchensammlung.models import Log, TrustLevel, Location, AdoptionNoticeStatusChoices
from fellchensammlung.tasks import post_adoption_notice_save, post_rescue_org_save from fellchensammlung.tasks import post_adoption_notice_save, post_rescue_org_save
from rest_framework import status, serializers from rest_framework import status, serializers
from rest_framework.permissions import IsAuthenticated from rest_framework.permissions import IsAuthenticated
@@ -20,7 +21,7 @@ from .serializers import (
SpeciesSerializer, RescueOrganizationSerializer, SpeciesSerializer, RescueOrganizationSerializer,
) )
from fellchensammlung.models import Animal, RescueOrganization, AdoptionNotice, Species, Image from fellchensammlung.models import Animal, RescueOrganization, AdoptionNotice, Species, Image
from drf_spectacular.utils import extend_schema, inline_serializer from drf_spectacular.utils import extend_schema, inline_serializer, OpenApiParameter
class AdoptionNoticeApiView(APIView): class AdoptionNoticeApiView(APIView):
@@ -73,9 +74,9 @@ class AdoptionNoticeApiView(APIView):
# Only set active when user has trust level moderator or higher # Only set active when user has trust level moderator or higher
if request.user_to_notify.trust_level >= TrustLevel.MODERATOR: if request.user_to_notify.trust_level >= TrustLevel.MODERATOR:
adoption_notice.set_active() adoption_notice.adoption_notice_status = AdoptionNoticeStatusChoices.Active.SEARCHING
else: else:
adoption_notice.set_unchecked() adoption_notice.adoption_notice_status = AdoptionNoticeStatusChoices.AwaitingAction.WAITING_FOR_REVIEW
# Log the action # Log the action
Log.objects.create( Log.objects.create(
@@ -374,7 +375,7 @@ class LocationApiView(APIView):
class AdoptionNoticeGeoJSONView(ListAPIView): class AdoptionNoticeGeoJSONView(ListAPIView):
queryset = AdoptionNotice.objects.select_related('location').filter(location__isnull=False).filter( queryset = AdoptionNotice.objects.select_related('location').filter(location__isnull=False).filter(
adoptionnoticestatus__major_status=AdoptionNoticeStatus.ACTIVE) adoption_notice_status__in=AdoptionNoticeStatusChoices.Active.values)
serializer_class = AdoptionNoticeGeoJSONSerializer serializer_class = AdoptionNoticeGeoJSONSerializer
renderer_classes = [GeoJSONRenderer] renderer_classes = [GeoJSONRenderer]
@@ -383,3 +384,69 @@ class RescueOrgGeoJSONView(ListAPIView):
queryset = RescueOrganization.objects.select_related('location').filter(location__isnull=False) queryset = RescueOrganization.objects.select_related('location').filter(location__isnull=False)
serializer_class = RescueOrgeGeoJSONSerializer serializer_class = RescueOrgeGeoJSONSerializer
renderer_classes = [GeoJSONRenderer] renderer_classes = [GeoJSONRenderer]
class AdoptionNoticePerOrgApiView(APIView):
permission_classes = [IsAuthenticated]
@extend_schema(
parameters=[
OpenApiParameter(
name='id',
required=False,
description='ID of the rescue organization from which to retrieve adoption notices.',
type=OpenApiTypes.INT
),
OpenApiParameter(
name='in_hierarchy',
type=OpenApiTypes.BOOL,
required=False,
description='Show all Adoption Notices in hierarchy.',
),
OpenApiParameter(
name='status',
type=OpenApiTypes.STR,
required=False,
description='Show all Adoption Notices in a certain status. Comma separated list of values e.g. '
'"active,closed"',
),
],
responses={200: AdoptionNoticeSerializer(many=True)}
)
def get(self, request, *args, **kwargs):
"""
Retrieve adoption notices with their related animals and images.
"""
org_id = kwargs.get("id")
in_hierarchy = request.query_params.get("in_hierarchy")
an_status = request.query_params.get("status")
try:
org = RescueOrganization.objects.get(id=org_id)
except RescueOrganization.DoesNotExist:
return Response({"error": "Rescue Organization notice not found."}, status=status.HTTP_404_NOT_FOUND)
if in_hierarchy:
adoption_notices = org.adoption_notices_in_hierarchy
else:
adoption_notices = AdoptionNotice.objects.filter(organization=org)
if an_status:
status_list = an_status.lower().strip().split(",")
temporary_an_storage = []
if "active" in status_list:
active_ans = [adoption_notice for adoption_notice in adoption_notices if
adoption_notice.adoption_notice_status in AdoptionNoticeStatusChoices.Active.values]
temporary_an_storage.extend(active_ans)
if "closed" in status_list:
closed_ans = [adoption_notice for adoption_notice in adoption_notices if
adoption_notice.adoption_notice_status in AdoptionNoticeStatusChoices.Closed.values]
temporary_an_storage.extend(closed_ans)
if "disabled" in status_list:
disabled_ans = [adoption_notice for adoption_notice in adoption_notices if
adoption_notice.adoption_notice_status in AdoptionNoticeStatusChoices.Disabled.values]
temporary_an_storage.extend(disabled_ans)
if "awaiting_action" in status_list:
awaiting_action_ans = [adoption_notice for adoption_notice in adoption_notices if
adoption_notice.adoption_notice_status in AdoptionNoticeStatusChoices.AwaitingAction.values]
temporary_an_storage.extend(awaiting_action_ans)
adoption_notices = temporary_an_storage
serializer = AdoptionNoticeSerializer(adoption_notices, many=True, context={"request": request})
return Response(serializer.data, status=status.HTTP_200_OK)

View File

View File

@@ -0,0 +1,37 @@
from django.shortcuts import get_object_or_404, render
from django.views.decorators.clickjacking import xframe_options_exempt
from fellchensammlung.aviews.helpers import headers
from fellchensammlung.models import RescueOrganization, AdoptionNotice, Species
@xframe_options_exempt
@headers({"X-Robots-Tag": "noindex"})
def list_ans_per_rescue_organization(request, rescue_organization_id, species_slug=None, active=True):
expand = request.GET.get("expand")
background_color = request.GET.get("background_color")
if expand is not None:
expand = True
else:
expand = False
org = get_object_or_404(RescueOrganization, pk=rescue_organization_id)
# Get only active adoption notices or all
if active:
adoption_notices_of_org = org.adoption_notices_in_hierarchy_divided_by_status[0]
else:
adoption_notices_of_org = org.adoption_notices
# Filter for Species if necessary
if species_slug is None:
adoption_notices = adoption_notices_of_org
else:
species = get_object_or_404(Species, slug=species_slug)
adoption_notices = [adoption_notice for adoption_notice in adoption_notices_of_org if
species in adoption_notice.species]
template = 'fellchensammlung/embeddables/list-adoption-notices.html'
return render(request, template,
context={"adoption_notices": adoption_notices,
"expand": expand,
"background_color": background_color})

View File

@@ -0,0 +1,23 @@
def headers(headers):
"""Decorator adding arbitrary HTTP headers to the response.
This decorator adds HTTP headers specified in the argument (map), to the
HTTPResponse returned by the function being decorated.
Example:
@headers({'Refresh': '10', 'X-Bender': 'Bite my shiny, metal ass!'})
def index(request):
....
Source: https://djangosnippets.org/snippets/275/
"""
def headers_wrapper(fun):
def wrapped_function(*args, **kwargs):
response = fun(*args, **kwargs)
for key in headers:
response[key] = headers[key]
return response
return wrapped_function
return headers_wrapper

View File

@@ -0,0 +1,12 @@
from django.urls import path
from . import embeddables
urlpatterns = [
path("tierschutzorganisationen/<int:rescue_organization_id>/vermittlungen/",
embeddables.list_ans_per_rescue_organization,
name="list-adoption-notices-for-rescue-organization"),
path("tierschutzorganisationen/<int:rescue_organization_id>/vermittlungen/<slug:species_slug>/",
embeddables.list_ans_per_rescue_organization,
name="list-adoption-notices-for-rescue-organization-species"),
]

View File

@@ -1,4 +1,5 @@
from django import forms from django import forms
from django.forms.widgets import Textarea
from .models import AdoptionNotice, Animal, Image, ReportAdoptionNotice, ReportComment, ModerationAction, User, Species, \ from .models import AdoptionNotice, Animal, Image, ReportAdoptionNotice, ReportComment, ModerationAction, User, Species, \
Comment, SexChoicesWithAll, DistanceChoices, SpeciesSpecificURL, RescueOrganization Comment, SexChoicesWithAll, DistanceChoices, SpeciesSpecificURL, RescueOrganization
@@ -9,6 +10,8 @@ from django.utils.translation import gettext_lazy as _
from notfellchen.settings import MEDIA_URL from notfellchen.settings import MEDIA_URL
from crispy_forms.layout import Div from crispy_forms.layout import Div
from .tools.model_helpers import reason_for_signup_label, reason_for_signup_help_text
def animal_validator(value: str): def animal_validator(value: str):
value = value.lower() value = value.lower()
@@ -57,6 +60,14 @@ class AnimalForm(forms.ModelForm):
} }
class UpdateRescueOrgRegularCheckStatus(forms.ModelForm):
template_name = "fellchensammlung/forms/form_snippets.html"
class Meta:
model = RescueOrganization
fields = ["regular_check_status"]
class ImageForm(forms.ModelForm): class ImageForm(forms.ModelForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
if 'in_flow' in kwargs: if 'in_flow' in kwargs:
@@ -129,6 +140,18 @@ class ModerationActionForm(forms.ModelForm):
fields = ('action', 'public_comment', 'private_comment') fields = ('action', 'public_comment', 'private_comment')
class AddedRegistrationForm(forms.Form):
reason_for_signup = forms.CharField(label=reason_for_signup_label,
help_text=reason_for_signup_help_text,
widget=Textarea)
captcha = forms.CharField(validators=[animal_validator], label=_("Nenne eine bekannte Tierart"), help_text=_(
"Bitte nenne hier eine bekannte Tierart (z.B. ein Tier das an der Leine geführt wird). Das Fragen wir dich um "
"sicherzustellen, dass du kein Roboter bist."))
def signup(self, request, user):
pass
class CustomRegistrationForm(RegistrationForm): class CustomRegistrationForm(RegistrationForm):
class Meta(RegistrationForm.Meta): class Meta(RegistrationForm.Meta):
model = User model = User
@@ -153,5 +176,5 @@ class RescueOrgSearchForm(forms.Form):
template_name = "fellchensammlung/forms/form_snippets.html" template_name = "fellchensammlung/forms/form_snippets.html"
location_string = forms.CharField(max_length=100, label=_("Stadt"), required=False) location_string = forms.CharField(max_length=100, label=_("Stadt"), required=False)
max_distance = forms.ChoiceField(choices=DistanceChoices, initial=DistanceChoices.ONE_HUNDRED, max_distance = forms.ChoiceField(choices=DistanceChoices, initial=DistanceChoices.TWENTY,
label=_("Suchradius")) label=_("Suchradius"))

View File

@@ -0,0 +1,13 @@
from django.core.management import BaseCommand
from notfellchen import settings
class Command(BaseCommand):
help = 'Print the current settings'
def handle(self, *args, **options):
for key in settings.__dir__():
if key.startswith("_") or key == "SECRET_KEY":
continue
print(f"{key} = {getattr(settings, key)}")

View File

@@ -0,0 +1,87 @@
# Generated by Django 5.2.1 on 2025-08-30 21:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fellchensammlung', '0059_rescueorganization_twenty_id_and_more'),
]
operations = [
migrations.AlterModelOptions(
name='adoptionnotice',
options={'permissions': [('create_active_adoption_notice', 'Can create an active adoption notice')], 'verbose_name': 'Vermittlung', 'verbose_name_plural': 'Vermittlungen'},
),
migrations.AlterModelOptions(
name='adoptionnoticestatus',
options={'verbose_name': 'Vermittlungsstatus', 'verbose_name_plural': 'Vermittlungsstati'},
),
migrations.AlterModelOptions(
name='animal',
options={'verbose_name': 'Tier', 'verbose_name_plural': 'Tiere'},
),
migrations.AlterModelOptions(
name='announcement',
options={'verbose_name': 'Banner', 'verbose_name_plural': 'Banner'},
),
migrations.AlterModelOptions(
name='comment',
options={'verbose_name': 'Kommentar', 'verbose_name_plural': 'Kommentare'},
),
migrations.AlterModelOptions(
name='image',
options={'verbose_name': 'Bild', 'verbose_name_plural': 'Bilder'},
),
migrations.AlterModelOptions(
name='importantlocation',
options={'verbose_name': 'Wichtiger Standort', 'verbose_name_plural': 'Wichtige Standorte'},
),
migrations.AlterModelOptions(
name='location',
options={'verbose_name': 'Standort', 'verbose_name_plural': 'Standorte'},
),
migrations.AlterModelOptions(
name='moderationaction',
options={'verbose_name': 'Moderationsaktion', 'verbose_name_plural': 'Moderationsaktionen'},
),
migrations.AlterModelOptions(
name='notification',
options={'verbose_name': 'Benachrichtigung', 'verbose_name_plural': 'Benachrichtigungen'},
),
migrations.AlterModelOptions(
name='report',
options={'verbose_name': 'Meldung', 'verbose_name_plural': 'Meldungen'},
),
migrations.AlterModelOptions(
name='rescueorganization',
options={'ordering': ['name'], 'verbose_name': 'Tierschutzorganisation', 'verbose_name_plural': 'Tierschutzorganisationen'},
),
migrations.AlterModelOptions(
name='rule',
options={'verbose_name': 'Regel', 'verbose_name_plural': 'Regeln'},
),
migrations.AlterModelOptions(
name='searchsubscription',
options={'verbose_name': 'Abonnierte Suche', 'verbose_name_plural': 'Abonnierte Suchen'},
),
migrations.AlterModelOptions(
name='speciesspecificurl',
options={'verbose_name': 'Tierartspezifische URL', 'verbose_name_plural': 'Tierartspezifische URLs'},
),
migrations.AlterModelOptions(
name='subscriptions',
options={'verbose_name': 'Abonnement', 'verbose_name_plural': 'Abonnements'},
),
migrations.AlterModelOptions(
name='timestamp',
options={'verbose_name': 'Zeitstempel', 'verbose_name_plural': 'Zeitstempel'},
),
migrations.AddField(
model_name='adoptionnotice',
name='adoption_notice_status',
field=models.TextField(choices=[('active_searching', 'Searching'), ('active_interested', 'Interested'), ('awaiting_action_waiting_for_review', 'Waiting for review'), ('awaiting_action_needs_additional_info', 'Needs additional info'), ('closed_successful_with_notfellchen', 'Successful (with Notfellchen)'), ('closed_successful_without_notfellchen', 'Successful (without Notfellchen)'), ('closed_animal_died', 'Animal died'), ('closed_for_other_adoption_notice', 'Closed for other adoption notice'), ('closed_not_open_for_adoption_anymore', 'Not open for adoption anymore'), ('closed_other', 'Other (closed)'), ('disabled_against_the_rules', 'Against the rules'), ('disabled_unchecked', 'Unchecked'), ('disabled_other', 'Other (disabled)')], default='disabled_other', max_length=64, verbose_name='Status'),
preserve_default=False,
),
]

View File

@@ -0,0 +1,63 @@
# Generated by Django 5.2.1 on 2025-08-30 21:51
import logging
from django.db import migrations
def map_status(adoption_notice_status):
minor = adoption_notice_status.minor_status
if minor == "searching":
return "active_searching"
if minor == "interested":
return "active_interested"
if minor == "waiting_for_review":
return "awaiting_action_waiting_for_review"
if minor == "needs_additional_info":
return "awaiting_action_needs_additional_info"
if minor == "successful_with_notfellchen":
return "closed_successful_with_notfellchen"
if minor == "successful_without_notfellchen":
return "closed_successful_without_notfellchen"
if minor == "animal_died":
return "closed_animal_died"
if minor == "closed_for_other_adoption_notice":
return "closed_for_other_adoption_notice"
if minor == "not_open_for_adoption_anymore":
return "closed_not_open_for_adoption_anymore"
if minor == "other":
return "closed_other"
if minor == "against_the_rules":
return "disabled_against_the_rules"
if minor == "unchecked":
return "disabled_unchecked"
if minor in ["missing_information", "technical_error"]:
return "disabled_other"
return None
def migrate_status(apps, schema_editor):
# We can't import the model directly as it may be a newer
# version than this migration expects. We use the historical version.
AdoptionNoticeStatus = apps.get_model("fellchensammlung", "AdoptionNoticeStatus")
AdoptionNotice = apps.get_model("fellchensammlung", "AdoptionNotice")
for ans in AdoptionNoticeStatus.objects.all():
adoption_notice = AdoptionNotice.objects.get(id=ans.adoption_notice.id)
new_status = map_status(ans)
logging.debug(f"{ans.minor_status} -> {new_status}")
adoption_notice.adoption_notice_status = map_status(ans)
adoption_notice.save()
class Migration(migrations.Migration):
dependencies = [
('fellchensammlung', '0060_alter_adoptionnotice_options_and_more'),
]
operations = [
migrations.RunPython(migrate_status),
]

View File

@@ -0,0 +1,21 @@
# Generated by Django 5.2.1 on 2025-08-30 22:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fellchensammlung', '0061_datamigration_status_model_to_field'),
]
operations = [
migrations.AlterField(
model_name='adoptionnotice',
name='adoption_notice_status',
field=models.TextField(choices=[('active_searching', 'Searching'), ('active_interested', 'Interested'), ('awaiting_action_waiting_for_review', 'Waiting for review'), ('awaiting_action_needs_additional_info', 'Needs additional info'), ('closed_successful_with_notfellchen', 'Successful (with Notfellchen)'), ('closed_successful_without_notfellchen', 'Successful (without Notfellchen)'), ('closed_animal_died', 'Animal died'), ('closed_for_other_adoption_notice', 'Closed for other adoption notice'), ('closed_not_open_for_adoption_anymore', 'Not open for adoption anymore'), ('closed_link_to_more_info_not_reachable', 'Der Link zu weiteren Informationen ist nicht mehr erreichbar.'), ('closed_other', 'Other (closed)'), ('disabled_against_the_rules', 'Against the rules'), ('disabled_unchecked', 'Unchecked'), ('disabled_other', 'Other (disabled)')], max_length=64, verbose_name='Status'),
),
migrations.DeleteModel(
name='AdoptionNoticeStatus',
),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.2.1 on 2025-09-05 14:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fellchensammlung', '0062_alter_adoptionnotice_adoption_notice_status_and_more'),
]
operations = [
migrations.AddField(
model_name='adoptionnotice',
name='adoption_process',
field=models.TextField(blank=True, choices=[('contact_person_in_an', 'Kontaktiere die Person im Vermittlungstext')], max_length=64, null=True, verbose_name='Adoptionsprozess'),
),
]

View File

@@ -0,0 +1,140 @@
# Generated by Django 5.2.1 on 2025-09-06 11:11
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fellchensammlung', '0063_adoptionnotice_adoption_process'),
]
operations = [
migrations.AlterField(
model_name='animal',
name='name',
field=models.CharField(max_length=200, verbose_name='Name'),
),
migrations.AlterField(
model_name='animal',
name='photos',
field=models.ManyToManyField(blank=True, to='fellchensammlung.image', verbose_name='Fotos'),
),
migrations.AlterField(
model_name='animal',
name='sex',
field=models.CharField(choices=[('F', 'Weiblich'), ('M', 'Männlich'), ('M_N', 'Männlich, kastriert'), ('F_N', 'Weiblich, kastriert'), ('I', 'Intergeschlechtlich')], max_length=20, verbose_name='Geschlecht'),
),
migrations.AlterField(
model_name='comment',
name='adoption_notice',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fellchensammlung.adoptionnotice', verbose_name='Vermittlung'),
),
migrations.AlterField(
model_name='image',
name='alt_text',
field=models.TextField(help_text='Beschreibe das Bild für blinde und sehbehinderte Menschen', max_length=2000, verbose_name='Alternativtext'),
),
migrations.AlterField(
model_name='location',
name='city',
field=models.CharField(blank=True, max_length=200, null=True, verbose_name='Stadt'),
),
migrations.AlterField(
model_name='location',
name='county',
field=models.CharField(blank=True, max_length=200, null=True, verbose_name='Landkreis'),
),
migrations.AlterField(
model_name='location',
name='housenumber',
field=models.CharField(blank=True, max_length=20, null=True, verbose_name='Hausnummer'),
),
migrations.AlterField(
model_name='location',
name='latitude',
field=models.FloatField(verbose_name='Breitengrad'),
),
migrations.AlterField(
model_name='location',
name='longitude',
field=models.FloatField(verbose_name='Längengrad'),
),
migrations.AlterField(
model_name='location',
name='postcode',
field=models.CharField(blank=True, max_length=20, null=True, verbose_name='Postleitzahl'),
),
migrations.AlterField(
model_name='location',
name='street',
field=models.CharField(blank=True, max_length=200, null=True, verbose_name='Straße'),
),
migrations.AlterField(
model_name='notification',
name='user_to_notify',
field=models.ForeignKey(help_text='Useraccount der benachrichtigt wird', on_delete=django.db.models.deletion.CASCADE, related_name='user', to=settings.AUTH_USER_MODEL, verbose_name='Empfänger*in'),
),
migrations.AlterField(
model_name='report',
name='created_at',
field=models.DateTimeField(auto_now_add=True, verbose_name='Erstellt am'),
),
migrations.AlterField(
model_name='report',
name='updated_at',
field=models.DateTimeField(auto_now=True, verbose_name='Zuletzt geändert am'),
),
migrations.AlterField(
model_name='rule',
name='created_at',
field=models.DateTimeField(auto_now_add=True, verbose_name='Erstellt am'),
),
migrations.AlterField(
model_name='rule',
name='language',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='fellchensammlung.language', verbose_name='Sprache'),
),
migrations.AlterField(
model_name='rule',
name='rule_identifier',
field=models.CharField(help_text='Ein eindeutiger Identifikator der Regel. Ein Regelobjekt derselben Regel in einer anderen Sprache muss den gleichen Identifikator haben', max_length=24, verbose_name='Regel-ID'),
),
migrations.AlterField(
model_name='rule',
name='rule_text',
field=models.TextField(verbose_name='Regeltext'),
),
migrations.AlterField(
model_name='rule',
name='updated_at',
field=models.DateTimeField(auto_now=True, verbose_name='Zuletzt geändert am'),
),
migrations.AlterField(
model_name='searchsubscription',
name='created_at',
field=models.DateTimeField(auto_now_add=True, verbose_name='Erstellt am'),
),
migrations.AlterField(
model_name='searchsubscription',
name='sex',
field=models.CharField(choices=[('F', 'Weiblich'), ('M', 'Männlich'), ('M_N', 'Männlich, kastriert'), ('F_N', 'Weiblich Kastriert'), ('I', 'Intergeschlechtlich'), ('A', 'Alle')], max_length=20, verbose_name='Geschlecht'),
),
migrations.AlterField(
model_name='searchsubscription',
name='updated_at',
field=models.DateTimeField(auto_now=True, verbose_name='Zuletzt geändert am'),
),
migrations.AlterField(
model_name='subscriptions',
name='adoption_notice',
field=models.ForeignKey(help_text='Vermittlung die abonniert wurde', on_delete=django.db.models.deletion.CASCADE, to='fellchensammlung.adoptionnotice', verbose_name='Vermittlung'),
),
migrations.AlterField(
model_name='text',
name='title',
field=models.CharField(max_length=100, verbose_name='Titel'),
),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.2.1 on 2025-09-06 13:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fellchensammlung', '0064_alter_animal_name_alter_animal_photos_and_more'),
]
operations = [
migrations.AddField(
model_name='species',
name='slug',
field=models.SlugField(null=True, unique=True, verbose_name='Slug'),
),
]

View File

@@ -0,0 +1,20 @@
# Generated by Django 5.2.1 on 2025-09-06 13:05
from django.db import migrations
def migrate_slug(apps, schema_editor):
Species = apps.get_model("fellchensammlung", "Species")
for species in Species.objects.all():
species.slug = f"species-{species.id}"
species.save()
class Migration(migrations.Migration):
dependencies = [
('fellchensammlung', '0065_species_slug'),
]
operations = [
migrations.RunPython(migrate_slug),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.2.1 on 2025-09-06 13:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fellchensammlung', '0066_add_slug_to_species'),
]
operations = [
migrations.AlterField(
model_name='species',
name='slug',
field=models.SlugField(unique=True, verbose_name='Slug'),
),
]

View File

@@ -0,0 +1,23 @@
# Generated by Django 5.2.1 on 2025-09-29 15:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fellchensammlung', '0067_alter_species_slug'),
]
operations = [
migrations.AlterField(
model_name='adoptionnotice',
name='adoption_notice_status',
field=models.TextField(choices=[('active_searching', 'Searching'), ('active_interested', 'Interested'), ('awaiting_action_waiting_for_review', 'Waiting for review'), ('awaiting_action_needs_additional_info', 'Needs additional info'), ('awaiting_action_unchecked', 'Unchecked'), ('closed_successful_with_notfellchen', 'Successful (with Notfellchen)'), ('closed_successful_without_notfellchen', 'Successful (without Notfellchen)'), ('closed_animal_died', 'Animal died'), ('closed_for_other_adoption_notice', 'Closed for other adoption notice'), ('closed_not_open_for_adoption_anymore', 'Not open for adoption anymore'), ('closed_link_to_more_info_not_reachable', 'Der Link zu weiteren Informationen ist nicht mehr erreichbar.'), ('closed_other', 'Other (closed)'), ('disabled_against_the_rules', 'Against the rules'), ('disabled_other', 'Other (disabled)')], max_length=64, verbose_name='Status'),
),
migrations.AlterField(
model_name='image',
name='image',
field=models.ImageField(help_text='Wähle ein Bild aus', upload_to='images', verbose_name='Bild'),
),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.2.1 on 2025-10-20 08:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fellchensammlung', '0068_alter_adoptionnotice_adoption_notice_status_and_more'),
]
operations = [
migrations.AddField(
model_name='rescueorganization',
name='regular_check_status',
field=models.CharField(choices=[('regular_check', 'Wird regelmäßig geprüft'), ('excluded_no_online_listing', 'Exkludiert: Tiere werden nicht online gelistet'), ('excluded_other_org', 'Exkludiert: Andere Organisation wird geprüft'), ('excluded_scope', 'Exkludiert: Organisation hat nie Notfellchen-relevanten Vermittlungen'), ('excluded_other', 'Exkludiert: Anderer Grund')], default='regular_check', help_text='Organisationen können, durch ändern dieser Einstellung, von der regelmäßigen Prüfung ausgeschlossen werden.', max_length=30, verbose_name='Status der regelmäßigen Prüfung'),
),
]

View File

@@ -1,23 +1,20 @@
import uuid import uuid
from random import choices
from tabnanny import verbose
from django.db import models from django.db import models
from django.template.defaultfilters import slugify
from django.urls import reverse from django.urls import reverse
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.utils import timezone from django.utils import timezone
from django.dispatch import receiver
from django.db.models.signals import post_save
from django.contrib.auth.models import Group from django.contrib.auth.models import Group
from django.contrib.auth.models import AbstractUser from django.contrib.auth.models import AbstractUser
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
import base64
from .tools import misc, geo from .tools import misc, geo
from notfellchen.settings import MEDIA_URL, base_url from notfellchen.settings import MEDIA_URL, base_url
from .tools.geo import LocationProxy, Position from .tools.geo import LocationProxy, Position
from .tools.misc import age_as_hr_string, time_since_as_hr_string from .tools.misc import time_since_as_hr_string
from .tools.model_helpers import NotificationTypeChoices from .tools.model_helpers import NotificationTypeChoices, AdoptionNoticeStatusChoices, AdoptionProcess, \
AdoptionNoticeStatusChoicesDescriptions, RegularCheckStatusChoices, reason_for_signup_label, \
reason_for_signup_help_text
from .tools.model_helpers import ndm as NotificationDisplayMapping from .tools.model_helpers import ndm as NotificationDisplayMapping
@@ -44,14 +41,14 @@ class Language(models.Model):
class Location(models.Model): class Location(models.Model):
place_id = models.CharField(max_length=200) # OSM id place_id = models.CharField(max_length=200) # OSM id
latitude = models.FloatField() latitude = models.FloatField(verbose_name=_("Breitengrad"))
longitude = models.FloatField() longitude = models.FloatField(verbose_name=_("Längengrad"))
name = models.CharField(max_length=2000) name = models.CharField(max_length=2000)
city = models.CharField(max_length=200, blank=True, null=True) city = models.CharField(max_length=200, blank=True, null=True, verbose_name=_('Stadt'))
housenumber = models.CharField(max_length=20, blank=True, null=True) housenumber = models.CharField(max_length=20, blank=True, null=True, verbose_name=_("Hausnummer"))
postcode = models.CharField(max_length=20, blank=True, null=True) postcode = models.CharField(max_length=20, blank=True, null=True, verbose_name=_("Postleitzahl"))
street = models.CharField(max_length=200, blank=True, null=True) street = models.CharField(max_length=200, blank=True, null=True, verbose_name=_("Straße"))
county = models.CharField(max_length=200, blank=True, null=True) county = models.CharField(max_length=200, blank=True, null=True, verbose_name=_("Landkreis"))
# Country code as per ISO 3166-1 alpha-2 # Country code as per ISO 3166-1 alpha-2
# https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes # https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
countrycode = models.CharField(max_length=2, verbose_name=_("Ländercode"), countrycode = models.CharField(max_length=2, verbose_name=_("Ländercode"),
@@ -135,6 +132,7 @@ class Species(models.Model):
"""Model representing a species of animal.""" """Model representing a species of animal."""
name = models.CharField(max_length=200, help_text=_('Name der Tierart'), name = models.CharField(max_length=200, help_text=_('Name der Tierart'),
verbose_name=_('Name')) verbose_name=_('Name'))
slug = models.SlugField(unique=True, verbose_name=_('Slug'))
updated_at = models.DateTimeField(auto_now=True) updated_at = models.DateTimeField(auto_now=True)
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True)
@@ -175,6 +173,12 @@ class RescueOrganization(models.Model):
exclude_from_check = models.BooleanField(default=False, verbose_name=_('Von Prüfung ausschließen'), exclude_from_check = models.BooleanField(default=False, verbose_name=_('Von Prüfung ausschließen'),
help_text=_("Organisation von der manuellen Überprüfung ausschließen, " help_text=_("Organisation von der manuellen Überprüfung ausschließen, "
"z.B. weil Tiere nicht online geführt werden")) "z.B. weil Tiere nicht online geführt werden"))
regular_check_status = models.CharField(max_length=30, choices=RegularCheckStatusChoices.choices,
default=RegularCheckStatusChoices.REGULAR_CHECK,
verbose_name=_('Status der regelmäßigen Prüfung'),
help_text=_(
"Organisationen können, durch ändern dieser Einstellung, von der "
"regelmäßigen Prüfung ausgeschlossen werden."))
ongoing_communication = models.BooleanField(default=False, verbose_name=_('In aktiver Kommunikation'), ongoing_communication = models.BooleanField(default=False, verbose_name=_('In aktiver Kommunikation'),
help_text=_( help_text=_(
"Es findet gerade Kommunikation zwischen Notfellchen und der Organisation statt.")) "Es findet gerade Kommunikation zwischen Notfellchen und der Organisation statt."))
@@ -264,10 +268,6 @@ class RescueOrganization(models.Model):
""" """
return self.instagram or self.facebook or self.website or self.phone_number or self.email or self.fediverse_profile return self.instagram or self.facebook or self.website or self.phone_number or self.email or self.fediverse_profile
def set_exclusion_from_checks(self):
self.exclude_from_check = True
self.save()
@property @property
def child_organizations(self): def child_organizations(self):
return RescueOrganization.objects.filter(parent_org=self) return RescueOrganization.objects.filter(parent_org=self)
@@ -308,8 +308,7 @@ class User(AbstractUser):
updated_at = models.DateTimeField(auto_now=True) updated_at = models.DateTimeField(auto_now=True)
organization_affiliation = models.ForeignKey(RescueOrganization, on_delete=models.PROTECT, null=True, blank=True, organization_affiliation = models.ForeignKey(RescueOrganization, on_delete=models.PROTECT, null=True, blank=True,
verbose_name=_('Organisation')) verbose_name=_('Organisation'))
reason_for_signup = models.TextField(verbose_name=_("Grund für die Registrierung"), help_text=_( reason_for_signup = models.TextField(verbose_name=reason_for_signup_label, help_text=reason_for_signup_help_text)
"Wir würden gerne wissen warum du dich registriertst, ob du dich z.B. Tiere eines bestimmten Tierheim einstellen willst 'nur mal gucken' willst. Beides ist toll! Wenn du für ein Tierheim/eine Pflegestelle arbeitest kontaktieren wir dich ggf. um dir erweiterte Rechte zu geben."))
email_notifications = models.BooleanField(verbose_name=_("Benachrichtigung per E-Mail"), default=True) email_notifications = models.BooleanField(verbose_name=_("Benachrichtigung per E-Mail"), default=True)
REQUIRED_FIELDS = ["reason_for_signup", "email"] REQUIRED_FIELDS = ["reason_for_signup", "email"]
@@ -348,8 +347,9 @@ class User(AbstractUser):
class Image(models.Model): class Image(models.Model):
image = models.ImageField(upload_to='images') image = models.ImageField(upload_to='images', verbose_name=_("Bild"), help_text=_("Wähle ein Bild aus"))
alt_text = models.TextField(max_length=2000, verbose_name=_('Alternativtext')) alt_text = models.TextField(max_length=2000, verbose_name=_('Alternativtext'),
help_text=_("Beschreibe das Bild für blinde und sehbehinderte Menschen"))
owner = models.ForeignKey(User, on_delete=models.CASCADE) owner = models.ForeignKey(User, on_delete=models.CASCADE)
updated_at = models.DateTimeField(auto_now=True) updated_at = models.DateTimeField(auto_now=True)
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True)
@@ -365,6 +365,11 @@ class Image(models.Model):
def as_html(self): def as_html(self):
return f'<img src="{MEDIA_URL}/{self.image}" alt="{self.alt_text}">' return f'<img src="{MEDIA_URL}/{self.image}" alt="{self.alt_text}">'
@property
def as_base64(self):
encoded_string = base64.b64encode(self.image.file.read())
return encoded_string.decode("utf-8")
class AdoptionNotice(models.Model): class AdoptionNotice(models.Model):
class Meta: class Meta:
@@ -395,6 +400,11 @@ class AdoptionNotice(models.Model):
location_string = models.CharField(max_length=200, verbose_name=_("Ortsangabe")) location_string = models.CharField(max_length=200, verbose_name=_("Ortsangabe"))
location = models.ForeignKey(Location, blank=True, null=True, on_delete=models.SET_NULL, ) location = models.ForeignKey(Location, blank=True, null=True, on_delete=models.SET_NULL, )
owner = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name=_('Creator')) owner = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name=_('Creator'))
adoption_notice_status = models.TextField(max_length=64, verbose_name=_('Status'),
choices=AdoptionNoticeStatusChoices.all_choices())
adoption_process = models.TextField(null=True, blank=True,
max_length=64, verbose_name=_('Adoptionsprozess'),
choices=AdoptionProcess)
@property @property
def animals(self): def animals(self):
@@ -411,9 +421,16 @@ class AdoptionNotice(models.Model):
def num_per_sex(self): def num_per_sex(self):
num_per_sex = dict() num_per_sex = dict()
for sex in SexChoices: for sex in SexChoices:
num_per_sex[sex] = self.animals.filter(sex=sex).count() num_per_sex[sex] = len([animal for animal in self.animals if animal.sex == sex])
return num_per_sex return num_per_sex
@property
def species(self):
species = set()
for animal in self.animals:
species.add(animal.species)
return species
@property @property
def last_checked_hr(self): def last_checked_hr(self):
time_since_last_checked = timezone.now() - self.last_checked time_since_last_checked = timezone.now() - self.last_checked
@@ -443,12 +460,21 @@ class AdoptionNotice(models.Model):
else: else:
return self.location.latitude, self.location.longitude return self.location.latitude, self.location.longitude
@property def _get_short_description(self, length: int) -> str:
def description_short(self):
if self.description is None: if self.description is None:
return "" return ""
if len(self.description) > 200: elif len(self.description) > length:
return self.description[:200] + f" ... [weiterlesen]({self.get_absolute_url()})" return self.description[:length] + f" ... [weiterlesen]({self.get_absolute_url()})"
else:
return self.description
@property
def description_short(self):
return self._get_short_description(200)
@property
def description_100_short(self):
return self._get_short_description(90)
def get_absolute_url(self): def get_absolute_url(self):
"""Returns the url to access a detailed page for the adoption notice.""" """Returns the url to access a detailed page for the adoption notice."""
@@ -485,6 +511,7 @@ class AdoptionNotice(models.Model):
photos.extend(animal.photos.all()) photos.extend(animal.photos.all())
if len(photos) > 0: if len(photos) > 0:
return photos return photos
return None
def get_photo(self): def get_photo(self):
""" """
@@ -510,60 +537,34 @@ class AdoptionNotice(models.Model):
""" """
return geo.object_in_distance(self, position, max_distance, unknown_true) return geo.object_in_distance(self, position, max_distance, unknown_true)
@staticmethod
def _values_of(list_of_enums):
return list(map(lambda x: x[0], list_of_enums))
@property @property
def is_active(self): def is_active(self):
if not hasattr(self, 'adoptionnoticestatus'): return self.adoption_notice_status in self._values_of(AdoptionNoticeStatusChoices.Active.choices)
return False
return self.adoptionnoticestatus.is_active
@property @property
def is_disabled(self): def is_disabled(self):
if not hasattr(self, 'adoptionnoticestatus'): return self.adoption_notice_status in self._values_of(AdoptionNoticeStatusChoices.Disabled.choices)
return False
return self.adoptionnoticestatus.is_disabled
@property @property
def is_closed(self): def is_closed(self):
if not hasattr(self, 'adoptionnoticestatus'): return self.adoption_notice_status in self._values_of(AdoptionNoticeStatusChoices.Closed.choices)
return False
return self.adoptionnoticestatus.is_closed
@property
def is_interested(self):
if not hasattr(self, 'adoptionnoticestatus'):
return False
return self.adoptionnoticestatus.is_interested
@property @property
def is_awaiting_action(self): def is_awaiting_action(self):
if not hasattr(self, 'adoptionnoticestatus'): return self.adoption_notice_status in self._values_of(AdoptionNoticeStatusChoices.AwaitingAction.choices)
return False
return self.adoptionnoticestatus.is_awaiting_action
@property @property
def is_disabled_unchecked(self): def status_description(self):
if not hasattr(self, 'adoptionnoticestatus'): return AdoptionNoticeStatusChoicesDescriptions.mapping[self.adoption_notice_status]
return False
return self.adoptionnoticestatus.is_disabled_unchecked
def set_closed(self, minor_status=None):
self.last_checked = timezone.now()
self.save()
self.adoptionnoticestatus.set_closed(minor_status)
def set_active(self):
self.last_checked = timezone.now()
self.save()
if not hasattr(self, 'adoptionnoticestatus'):
AdoptionNoticeStatus.create_other(self)
self.adoptionnoticestatus.set_active()
def set_unchecked(self): def set_unchecked(self):
self.last_checked = timezone.now() self.last_checked = timezone.now()
self.adoption_notice_status = AdoptionNoticeStatusChoices.AwaitingAction.UNCHECKED
self.save() self.save()
if not hasattr(self, 'adoptionnoticestatus'):
AdoptionNoticeStatus.create_other(self)
self.adoptionnoticestatus.set_unchecked()
for subscription in self.get_subscriptions(): for subscription in self.get_subscriptions():
notification_title = _("Vermittlung deaktiviert:") + f" {self.name}" notification_title = _("Vermittlung deaktiviert:") + f" {self.name}"
@@ -583,124 +584,6 @@ class AdoptionNotice(models.Model):
return last_post.created_at return last_post.created_at
class AdoptionNoticeStatus(models.Model):
"""
The major status indicates a general state of an adoption notice
whereas the minor status is used for reporting
"""
class Meta:
verbose_name = _('Vermittlungsstatus')
verbose_name_plural = _('Vermittlungsstati')
ACTIVE = "active"
AWAITING_ACTION = "awaiting_action"
CLOSED = "closed"
DISABLED = "disabled"
MAJOR_STATUS_CHOICES = {
ACTIVE: "active",
AWAITING_ACTION: "in review",
CLOSED: "closed",
DISABLED: "disabled",
}
MINOR_STATUS_CHOICES = {
ACTIVE: {
"searching": "searching",
"interested": "interested",
},
AWAITING_ACTION: {
"waiting_for_review": "waiting_for_review",
"needs_additional_info": "needs_additional_info",
},
CLOSED: {
"successful_with_notfellchen": "successful_with_notfellchen",
"successful_without_notfellchen": "successful_without_notfellchen",
"animal_died": "animal_died",
"closed_for_other_adoption_notice": "closed_for_other_adoption_notice",
"not_open_for_adoption_anymore": "not_open_for_adoption_anymore",
"other": "other"
},
DISABLED: {
"against_the_rules": "against_the_rules",
"missing_information": "missing_information",
"technical_error": "technical_error",
"unchecked": "unchecked",
"other": "other"
}
}
major_status = models.CharField(choices=MAJOR_STATUS_CHOICES, max_length=200)
minor_choices = {}
for key in MINOR_STATUS_CHOICES:
minor_choices.update(MINOR_STATUS_CHOICES[key])
minor_status = models.CharField(choices=minor_choices, max_length=200)
adoption_notice = models.OneToOneField(AdoptionNotice, on_delete=models.CASCADE)
updated_at = models.DateTimeField(auto_now=True)
created_at = models.DateTimeField(auto_now_add=True)
def __str__(self):
return f"{self.adoption_notice}: {self.major_status}, {self.minor_status}"
def as_string(self):
return f"{self.major_status}, {self.minor_status}"
@property
def is_active(self):
return self.major_status == self.ACTIVE
@property
def is_disabled(self):
return self.major_status == self.DISABLED
@property
def is_closed(self):
return self.major_status == self.CLOSED
@property
def is_awaiting_action(self):
return self.major_status == self.AWAITING_ACTION
@property
def is_interested(self):
return self.major_status == self.ACTIVE and self.minor_status == "interested"
@property
def is_disabled_unchecked(self):
return self.major_status == self.DISABLED and self.minor_status == "unchecked"
@staticmethod
def get_minor_choices(major_status):
return AdoptionNoticeStatus.MINOR_STATUS_CHOICES[major_status]
@staticmethod
def create_other(an_instance):
# Used as empty status to be changed immediately
major_status = AdoptionNoticeStatus.DISABLED
minor_status = AdoptionNoticeStatus.MINOR_STATUS_CHOICES[AdoptionNoticeStatus.DISABLED]["other"]
AdoptionNoticeStatus.objects.create(major_status=major_status,
minor_status=minor_status,
adoption_notice=an_instance)
def set_closed(self, minor_status=None):
self.major_status = self.MAJOR_STATUS_CHOICES[self.CLOSED]
if minor_status is None:
self.minor_status = self.MINOR_STATUS_CHOICES[self.CLOSED]["other"]
else:
self.minor_status = self.MINOR_STATUS_CHOICES[self.CLOSED][minor_status]
self.save()
def set_unchecked(self):
self.major_status = self.MAJOR_STATUS_CHOICES[self.DISABLED]
self.minor_status = self.MINOR_STATUS_CHOICES[self.DISABLED]["unchecked"]
self.save()
def set_active(self):
self.major_status = self.MAJOR_STATUS_CHOICES[self.ACTIVE]
self.minor_status = self.MINOR_STATUS_CHOICES[self.ACTIVE]["searching"]
self.save()
class SexChoices(models.TextChoices): class SexChoices(models.TextChoices):
FEMALE = "F", _("Weiblich") FEMALE = "F", _("Weiblich")
MALE = "M", _("Männlich") MALE = "M", _("Männlich")
@@ -724,13 +607,14 @@ class Animal(models.Model):
verbose_name_plural = _('Tiere') verbose_name_plural = _('Tiere')
date_of_birth = models.DateField(verbose_name=_('Geburtsdatum')) date_of_birth = models.DateField(verbose_name=_('Geburtsdatum'))
name = models.CharField(max_length=200) name = models.CharField(max_length=200, verbose_name=_('Name'))
description = models.TextField(null=True, blank=True, verbose_name=_('Beschreibung')) description = models.TextField(null=True, blank=True, verbose_name=_('Beschreibung'))
species = models.ForeignKey(Species, on_delete=models.PROTECT, verbose_name=_("Tierart")) species = models.ForeignKey(Species, on_delete=models.PROTECT, verbose_name=_("Tierart"))
photos = models.ManyToManyField(Image, blank=True) photos = models.ManyToManyField(Image, blank=True, verbose_name=_("Fotos"))
sex = models.CharField( sex = models.CharField(
max_length=20, max_length=20,
choices=SexChoices.choices, choices=SexChoices.choices,
verbose_name=_("Geschlecht")
) )
adoption_notice = models.ForeignKey(AdoptionNotice, on_delete=models.CASCADE) adoption_notice = models.ForeignKey(AdoptionNotice, on_delete=models.CASCADE)
owner = models.ForeignKey(User, on_delete=models.CASCADE) owner = models.ForeignKey(User, on_delete=models.CASCADE)
@@ -795,10 +679,10 @@ class SearchSubscription(models.Model):
owner = models.ForeignKey(User, on_delete=models.CASCADE) owner = models.ForeignKey(User, on_delete=models.CASCADE)
location = models.ForeignKey(Location, on_delete=models.PROTECT, null=True) location = models.ForeignKey(Location, on_delete=models.PROTECT, null=True)
sex = models.CharField(max_length=20, choices=SexChoicesWithAll.choices) sex = models.CharField(max_length=20, choices=SexChoicesWithAll.choices, verbose_name=_("Geschlecht"))
max_distance = models.IntegerField(choices=DistanceChoices.choices, null=True) max_distance = models.IntegerField(choices=DistanceChoices.choices, null=True)
updated_at = models.DateTimeField(auto_now=True) updated_at = models.DateTimeField(auto_now=True, verbose_name=_("Zuletzt geändert am"))
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True, verbose_name=_("Erstellt am"))
def __str__(self): def __str__(self):
if self.location and self.max_distance: if self.location and self.max_distance:
@@ -819,12 +703,16 @@ class Rule(models.Model):
title = models.CharField(max_length=200) title = models.CharField(max_length=200)
# Markdown is allowed in rule text # Markdown is allowed in rule text
rule_text = models.TextField() rule_text = models.TextField(verbose_name=_("Regeltext"))
language = models.ForeignKey(Language, on_delete=models.PROTECT) language = models.ForeignKey(Language, on_delete=models.PROTECT, verbose_name=_("Sprache"))
# Rule identifier allows to translate rules with the same identifier # Rule identifier allows to translate rules with the same identifier
rule_identifier = models.CharField(max_length=24) rule_identifier = models.CharField(max_length=24,
updated_at = models.DateTimeField(auto_now=True) verbose_name=_("Regel-ID"),
created_at = models.DateTimeField(auto_now_add=True) help_text=_("Ein eindeutiger Identifikator der Regel. Ein Regelobjekt "
"derselben Regel in einer anderen Sprache muss den gleichen "
"Identifikator haben"))
updated_at = models.DateTimeField(auto_now=True, verbose_name=_("Zuletzt geändert am"))
created_at = models.DateTimeField(auto_now_add=True, verbose_name=_("Erstellt am"))
def __str__(self): def __str__(self):
return self.title return self.title
@@ -848,8 +736,8 @@ class Report(models.Model):
status = models.CharField(max_length=30, choices=STATES) status = models.CharField(max_length=30, choices=STATES)
reported_broken_rules = models.ManyToManyField(Rule, verbose_name=_("Regeln gegen die verstoßen wurde")) reported_broken_rules = models.ManyToManyField(Rule, verbose_name=_("Regeln gegen die verstoßen wurde"))
user_comment = models.TextField(blank=True, verbose_name=_("Kommentar/Zusätzliche Information")) user_comment = models.TextField(blank=True, verbose_name=_("Kommentar/Zusätzliche Information"))
created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True, verbose_name=_("Zuletzt geändert am"))
updated_at = models.DateTimeField(auto_now=True) created_at = models.DateTimeField(auto_now_add=True, verbose_name=_("Erstellt am"))
def __str__(self): def __str__(self):
return f"[{self.status}]: {self.user_comment:.20}" return f"[{self.status}]: {self.user_comment:.20}"
@@ -953,7 +841,7 @@ class Text(models.Model):
""" """
Base class to store markdown content Base class to store markdown content
""" """
title = models.CharField(max_length=100) title = models.CharField(max_length=100, verbose_name=_("Titel"))
content = models.TextField(verbose_name="Inhalt") content = models.TextField(verbose_name="Inhalt")
language = models.ForeignKey(Language, verbose_name="Sprache", on_delete=models.PROTECT) language = models.ForeignKey(Language, verbose_name="Sprache", on_delete=models.PROTECT)
text_code = models.CharField(max_length=24, verbose_name="Text code", blank=True) text_code = models.CharField(max_length=24, verbose_name="Text code", blank=True)
@@ -1043,7 +931,7 @@ class Comment(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name=_('Nutzer*in')) user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name=_('Nutzer*in'))
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True) updated_at = models.DateTimeField(auto_now=True)
adoption_notice = models.ForeignKey(AdoptionNotice, on_delete=models.CASCADE, verbose_name=_('AdoptionNotice')) adoption_notice = models.ForeignKey(AdoptionNotice, on_delete=models.CASCADE, verbose_name=_('Vermittlung'))
text = models.TextField(verbose_name="Inhalt") text = models.TextField(verbose_name="Inhalt")
reply_to = models.ForeignKey("self", verbose_name="Antwort auf", blank=True, null=True, on_delete=models.CASCADE) reply_to = models.ForeignKey("self", verbose_name="Antwort auf", blank=True, null=True, on_delete=models.CASCADE)
@@ -1071,7 +959,7 @@ class Notification(models.Model):
user_to_notify = models.ForeignKey(User, user_to_notify = models.ForeignKey(User,
on_delete=models.CASCADE, on_delete=models.CASCADE,
verbose_name=_('Empfänger*in'), verbose_name=_('Empfänger*in'),
help_text=_("Useraccount der Benachrichtigt wird"), help_text=_("Useraccount der benachrichtigt wird"),
related_name='user') related_name='user')
title = models.CharField(max_length=100, verbose_name=_("Titel")) title = models.CharField(max_length=100, verbose_name=_("Titel"))
text = models.TextField(verbose_name="Inhalt") text = models.TextField(verbose_name="Inhalt")
@@ -1113,7 +1001,8 @@ class Subscriptions(models.Model):
verbose_name_plural = _("Abonnements") verbose_name_plural = _("Abonnements")
owner = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name=_('Nutzer*in')) owner = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name=_('Nutzer*in'))
adoption_notice = models.ForeignKey(AdoptionNotice, on_delete=models.CASCADE, verbose_name=_('AdoptionNotice')) adoption_notice = models.ForeignKey(AdoptionNotice, on_delete=models.CASCADE, verbose_name=_('Vermittlung'),
help_text=_("Vermittlung die abonniert wurde"))
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True) updated_at = models.DateTimeField(auto_now=True)
@@ -1181,7 +1070,7 @@ class SocialMediaPost(models.Model):
@staticmethod @staticmethod
def get_an_to_post(): def get_an_to_post():
adoption_notices_without_post = AdoptionNotice.objects.filter(socialmediapost__isnull=True, adoption_notices_without_post = AdoptionNotice.objects.filter(socialmediapost__isnull=True,
adoptionnoticestatus__major_status=AdoptionNoticeStatus.ACTIVE) adoption_notice_status__in=AdoptionNoticeStatusChoices.Active.values)
return adoption_notices_without_post.first() return adoption_notices_without_post.first()
def __str__(self): def __str__(self):

View File

@@ -45,6 +45,7 @@ $confirm: hsl(133deg, 100%, calc(41% + 0%));
p > a { p > a {
text-decoration: underline; text-decoration: underline;
word-break: break-all;
} }
p > a.button { p > a.button {
@@ -234,7 +235,7 @@ IMAGES
.thumbnail img { .thumbnail img {
width: 100%; width: 100%;
height: 50px; height: 70px;
object-fit: cover; /* Crops the images */ object-fit: cover; /* Crops the images */
border-radius: 4px; border-radius: 4px;
} }
@@ -346,3 +347,17 @@ AN Cards
right: 0; right: 0;
} }
/* Embedding Specifics */
.embed-main-content {
padding: 20px 10px 20px 10px;
}
// FLOATING BUTTON
.floating {
position: fixed;
border-radius: 0.3rem;
bottom: 4.5rem;
right: 1rem;
}

View File

@@ -1,423 +0,0 @@
function getCookie(name) {
let cookieValue = null;
if (document.cookie && document.cookie !== '') {
const cookies = document.cookie.split(';');
for (let i = 0; i < cookies.length; i++) {
const cookie = cookies[i].trim();
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) === (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
document.addEventListener('DOMContentLoaded', function () {
// ------------------------------------------------ functions
var show = function (elem) {
// Get the natural height of the element
var getHeight = function () {
elem.style.display = 'block'; // Make it visible
var height = elem.scrollHeight + 'px'; // Get its height
elem.style.display = ''; // Hide it again
return height;
};
var height = getHeight(); // Get the natural height
elem.classList.remove('closed');
elem.classList.add('open'); // Make the element visible
elem.setAttribute('aria-hidden', 'false');
elem.style.height = height; // Update the max-height
// Once the transition is complete, remove the inline max-height so the content can scale responsively
window.setTimeout(function () {
elem.style.height = '';
}, 500);
};
var hide = function (elem) {
// Give the element a height to change from
elem.style.height = elem.scrollHeight + 'px';
// Set the height back to 0
window.setTimeout(function () {
elem.style.height = '0';
}, 1);
// When the transition is complete, hide it
window.setTimeout(function () {
elem.classList.remove('open');
elem.classList.add('closed');
elem.setAttribute('aria-hidden', 'true');
}, 500);
};
var toggle = function (elem, timing) {
// If the element is visible, hide it
if (elem.classList.contains('open')) {
hide(elem);
return;
}
// Otherwise, show it
show(elem);
};
// ------------------------------------------------ build form
let orig_form = document.querySelector('form');
orig_form.style.display = 'none';
let an_max = 6;
let an_fieldset = document.createElement('fieldset');
an_fieldset.classList.add('cell');
let an_fieldset_legend = document.createElement('legend');
an_fieldset_legend.innerHTML = "Allgemeines";
an_fieldset.appendChild(an_fieldset_legend);
let an_name = document.createElement('input');
an_name.setAttribute('type', 'text');
an_name.setAttribute('name', 'name');
an_name.setAttribute('class', 'input');
an_name.setAttribute('maxlength', 200);
an_name.setAttribute('required', 'required');
let an_name_label = document.createElement('label');
an_name_label.setAttribute('class', 'label');
an_name_label.innerHTML = 'Titel der Vermittlung';
an_name_label.appendChild(an_name);
let an_location_string = document.createElement('input');
an_location_string.setAttribute('type', 'text');
an_location_string.setAttribute('name', 'location_string');
an_location_string.setAttribute('class', 'input');
an_location_string.setAttribute('maxlength', 200);
an_location_string.setAttribute('required', 'required');
let an_location_string_label = document.createElement('label');
an_location_string_label.setAttribute('class', 'label');
an_location_string_label.innerHTML = 'Ortsangabe';
an_location_string_label.appendChild(an_location_string);
let an_further_information = document.createElement('input');
an_further_information.setAttribute('type', 'url');
an_further_information.setAttribute('name', 'further_information');
an_further_information.setAttribute('class', 'input');
an_further_information.setAttribute('maxlength', 200);
let an_further_information_label = document.createElement('label');
an_further_information_label.setAttribute('class', 'label');
an_further_information_label.innerHTML = 'Link zu mehr Informationen';
an_further_information_label.appendChild(an_further_information);
let an_species = document.createElement('select');
let an_species_rat = document.createElement('option');
an_species_rat.value = 1;
an_species_rat.innerHTML = "Farbratte";
an_species.appendChild(an_species_rat);
an_species.setAttribute('name', 'species');
an_species.setAttribute('class', 'input');
an_species.setAttribute('required', 'required');
let an_species_label = document.createElement('label');
an_species_label.setAttribute('class', 'label');
an_species_label.innerHTML = 'Tierart';
an_species_label.appendChild(an_species);
let an_number = document.createElement('input');
an_number.setAttribute('type', 'number');
an_number.setAttribute('name', 'number');
an_number.setAttribute('class', 'input');
an_number.setAttribute('min', 1);
an_number.setAttribute('max', an_max);
an_number.setAttribute('required', 'required');
let an_number_label = document.createElement('label');
an_number_label.setAttribute('class', 'label');
an_number_label.innerHTML = 'Anzahl Tiere';
an_number_label.appendChild(an_number);
let an_dateofbirth = document.createElement('input');
an_dateofbirth.setAttribute('type', 'date');
an_dateofbirth.setAttribute('name', 'dateofbirth');
an_dateofbirth.setAttribute('class', 'input');
an_dateofbirth.setAttribute('maxlength', 200);
an_dateofbirth.setAttribute('required', 'required');
let an_dateofbirth_label = document.createElement('label');
an_dateofbirth_label.setAttribute('class', 'label');
an_dateofbirth_label.innerHTML = 'Geburtsdatum';
an_dateofbirth_label.appendChild(an_dateofbirth);
let an_sex = document.createElement('select');
let an_sex_F = document.createElement('option');
an_sex_F.value = 'F';
an_sex_F.innerHTML = "Weiblich";
an_sex.appendChild(an_sex_F);
let an_sex_M = document.createElement('option');
an_sex_M.value = 'M';
an_sex_M.innerHTML = "Männlich";
an_sex.appendChild(an_sex_M);
let an_sex_F_N = document.createElement('option');
an_sex_F_N.value = 'F_N';
an_sex_F_N.innerHTML = "Weiblich, kastriert";
an_sex.appendChild(an_sex_F_N);
let an_sex_M_N = document.createElement('option');
an_sex_M_N.value = 'M_N';
an_sex_M_N.innerHTML = "Männlich, kastriert";
an_sex.appendChild(an_sex_M_N);
let an_sex_I = document.createElement('option');
an_sex_I.value = 'I';
an_sex_I.innerHTML = "Intergeschlechtlich";
an_sex.appendChild(an_sex_I);
an_sex.setAttribute('name', 'sex');
an_sex.setAttribute('class', 'input');
an_sex.setAttribute('required', 'required');
let an_sex_label = document.createElement('label');
an_sex_label.setAttribute('class', 'label');
an_sex_label.innerHTML = 'Geschlecht';
an_sex_label.appendChild(an_sex);
let an_searching_since = document.createElement('input');
an_searching_since.setAttribute('type', 'date');
an_searching_since.setAttribute('name', 'searching_since');
an_searching_since.setAttribute('class', 'input');
an_searching_since.setAttribute('maxlength', 200);
an_searching_since.setAttribute('required', 'required');
let an_searching_since_label = document.createElement('label');
an_searching_since_label.setAttribute('class', 'label');
an_searching_since_label.innerHTML = 'neues Zuhause gesucht seit';
an_searching_since_label.appendChild(an_searching_since);
let an_group_only = document.createElement('select');
let an_group_only_yes = document.createElement('option');
an_group_only_yes.value = 1;
an_group_only_yes.innerHTML = "nur zusammen";
let an_group_only_no = document.createElement('option');
an_group_only_no.value = 0;
an_group_only_no.innerHTML = "auch einzeln";
an_group_only.appendChild(an_group_only_yes);
an_group_only.appendChild(an_group_only_no);
an_group_only.setAttribute('name', 'group_only');
an_group_only.setAttribute('class', 'input');
an_group_only.setAttribute('required', 'required');
let an_group_only_label = document.createElement('label');
an_group_only_label.setAttribute('class', 'label');
an_group_only_label.innerHTML = 'Gruppenvermittlung';
an_group_only_label.appendChild(an_group_only);
let animals = document.createElement('fieldset');
animals.classList.add('cell', 'is-col-span-2');
let animals_legend = document.createElement('legend');
animals_legend.innerHTML = 'Angaben zu den Tieren';
animals.appendChild(animals_legend);
let noteNumber = document.createElement('p');
noteNumber.setAttribute('id', 'noteNumber');
noteNumber.innerHTML = 'Bitte Anzahl Tiere angeben';
animals.appendChild(noteNumber);
let an_description = document.createElement('textarea');
an_description.setAttribute('name', 'an_description');
an_description.classList.add('input', 'textarea');
let an_description_label = document.createElement('label');
an_description_label.innerHTML = 'Beschreibung der Gruppe';
an_description_label.classList.add('label');
an_description_label.appendChild(an_description);
animals.appendChild(an_group_only_label);
animals.appendChild(an_description_label);
for (let i = 0; i < an_max; i++) {
let an_fieldset_$i = document.createElement('fieldset');
an_fieldset_$i.classList.add('animal-' + i, 'animal');
an_fieldset_$i.appendChild(document.createElement('legend'));
an_fieldset_$i.querySelector('legend').innerHTML = 'Tier ' + parseInt(i + 1);
let an_name_$i = document.createElement('input');
an_name_$i.setAttribute('type', 'text');
an_name_$i.setAttribute('name', 'name-' + i);
an_name_$i.setAttribute('class', 'input');
an_name_$i.setAttribute('maxlength', 200);
an_name_$i.setAttribute('required', 'required');
let an_name_$i_label = document.createElement('label');
an_name_$i_label.setAttribute('class', 'label');
an_name_$i_label.innerHTML = 'Name';
an_name_$i_label.appendChild(an_name_$i);
let an_dateofbirth_$i = document.createElement('input');
an_dateofbirth_$i.setAttribute('type', 'date');
an_dateofbirth_$i.setAttribute('name', 'dateofbirth');
an_dateofbirth_$i.setAttribute('class', 'input');
an_dateofbirth_$i.setAttribute('maxlength', 200);
an_dateofbirth_$i.setAttribute('required', 'required');
let an_dateofbirth_$i_label = document.createElement('label');
an_dateofbirth_$i_label.setAttribute('class', 'label');
an_dateofbirth_$i_label.innerHTML = 'Geburtsdatum';
an_dateofbirth_$i_label.appendChild(an_dateofbirth_$i);
let an_sex_$i = document.createElement('select');
let an_sex_F = document.createElement('option');
an_sex_F.value = 'F';
an_sex_F.innerHTML = "Weiblich";
an_sex_$i.appendChild(an_sex_F);
let an_sex_M = document.createElement('option');
an_sex_M.value = 'M';
an_sex_M.innerHTML = "Männlich";
an_sex_$i.appendChild(an_sex_M);
let an_sex_F_N = document.createElement('option');
an_sex_F_N.value = 'F_N';
an_sex_F_N.innerHTML = "Weiblich, kastriert";
an_sex_$i.appendChild(an_sex_F_N);
let an_sex_M_N = document.createElement('option');
an_sex_M_N.value = 'M_N';
an_sex_M_N.innerHTML = "Männlich, kastriert";
an_sex_$i.appendChild(an_sex_M_N);
let an_sex_I = document.createElement('option');
an_sex_I.value = 'I';
an_sex_I.innerHTML = "Intergeschlechtlich";
an_sex_$i.appendChild(an_sex_I);
an_sex_$i.setAttribute('name', 'sex');
an_sex_$i.setAttribute('class', 'input');
an_sex_$i.setAttribute('required', 'required');
let an_sex_$i_label = document.createElement('label');
an_sex_$i_label.setAttribute('class', 'label');
an_sex_$i_label.innerHTML = 'Geschlecht';
an_sex_$i_label.appendChild(an_sex_$i);
let an_description_$i = document.createElement('textarea');
an_description_$i.setAttribute('name', 'an_description');
an_description_$i.classList.add('input', 'textarea');
let an_description_$i_label = document.createElement('label');
an_description_$i_label.innerHTML = 'Beschreibung';
an_description_$i_label.classList.add('label');
an_description_$i_label.appendChild(an_description_$i);
an_fieldset_$i.appendChild(an_description_$i_label);
an_fieldset_$i.appendChild(an_name_$i_label);
an_fieldset_$i.appendChild(an_dateofbirth_$i_label);
an_fieldset_$i.appendChild(an_sex_$i_label);
an_fieldset_$i.appendChild(an_description_$i_label);
animals.appendChild(an_fieldset_$i);
}
an_fieldset.appendChild(an_name_label);
an_fieldset.appendChild(an_location_string_label);
an_fieldset.appendChild(an_further_information_label);
an_fieldset.appendChild(an_species_label);
an_fieldset.appendChild(an_number_label);
an_fieldset.appendChild(an_dateofbirth_label);
an_fieldset.appendChild(an_sex_label);
an_fieldset.appendChild(an_searching_since_label);
let new_form = document.createElement('form');
new_form.classList.add('new-animal-ad', 'fixed-grid', 'has-3-cols', 'has-1-cols-mobile');
let div = document.createElement('div');
div.classList.add('grid');
let sButton = document.createElement('button');
sButton.classList.add('button');
sButton.innerHTML = "Abschicken";
div.appendChild(an_fieldset);
div.appendChild(animals);
div.appendChild(sButton);
new_form.appendChild(div);
document.querySelector('.main-content').appendChild(new_form);
// ------------------------------------------------ listeners
// number of animals
let tmpAnimal;
an_number.addEventListener('change', function () {
if (an_number.value > 0) {
hide(noteNumber);
} else {
show(noteNumber);
}
if (an_number.value < 2) {
hide(an_description_label);
hide(an_group_only_label);
an_group_only.selectedIndex = 1;
} else {
show(an_description_label);
show(an_group_only_label);
an_group_only.selectedIndex = 0;
}
for (let i = 0; i < an_max; i++) {
tmpAnimal = document.querySelector('.animal-' + i);
if (i < an_number.value) {
tmpAnimal.removeAttribute('disabled');
show(tmpAnimal);
} else {
tmpAnimal.setAttribute('disabled', 'true');
hide(tmpAnimal);
}
}
});
// sex
an_sex.addEventListener('change', function () {
for (let i = 0; i < an_max; i++) {
let selList = document.querySelector('.animal-' + i).querySelector('[name="sex"]');
for (let j = 0; j < selList.options.length; j++) {
if (selList.options[j].value == an_sex.value) {
selList.selectedIndex = j;
break;
}
}
}
});
// date of birth
an_dateofbirth.addEventListener('change', function () {
for (let i = 0; i < an_max; i++) {
document.querySelector('.animal-' + i).querySelector('[name="dateofbirth"]').value = an_dateofbirth.value;
}
});
// ------------------------------------------------ initialise
show(noteNumber);
hide(an_description_label);
hide(an_group_only_label);
for (let i = 0; i < an_max; i++) {
hide(document.querySelector('.animal-' + i));
}
// ---------------------------------------------------- submit
new_form.addEventListener('submit', function (event) {
event.preventDefault();
let date = new Date();
let postDate = date.toISOString().slice(0, 10);
const path = '';
let elResultsBd = document.createElement('div');
elResultsBd.classList.add('feedback-backdrop');
let elResults = document.createElement('div');
elResults.classList.add('feedback-add-new');
elResultsBd.appendChild(elResults);
document.querySelector('body').appendChild(elResultsBd);
let data = JSON.stringify({
"created_at": postDate,
"searching_since": an_searching_since.value,
"name": an_name.value,
"description": an_description.value,
"further_information": an_further_information.value,
"group_only": an_group_only.value,
"location_string": an_location_string.value,
});
async function submitAN() {
const csrftoken = getCookie('csrftoken');
let response = await fetch('http://localhost:8000/api/adoption_notice', {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=utf-8',
'X-CSRFToken': csrftoken,
},
body: data,
});
console.log(response.status);
if (response.status === 201) {
let result = await response.json();
elResults.textContent = result.message + '<br>neue Id: ' + result.id;
elResults.classList.add('success');
} else {
elResults.textContent = 'Fehler! Status Code: ' + response.status;
elResults.classList.add('error');
}
}
submitAN();
});
});

View File

@@ -67,6 +67,51 @@ document.addEventListener('DOMContentLoaded', () => {
$el.classList.remove("is-active"); $el.classList.remove("is-active");
}); });
} }
// MODALS //
function openModal($el) {
$el.classList.add('is-active');
send("Modal.open", {
modal: $el.id
});
}
function closeModal($el) {
$el.classList.remove('is-active');
}
function closeAllModals() {
(document.querySelectorAll('.modal') || []).forEach(($modal) => {
closeModal($modal);
});
}
// Add a click event on buttons to open a specific modal
(document.querySelectorAll('.js-modal-trigger') || []).forEach(($trigger) => {
const modal = $trigger.dataset.target;
const $target = document.getElementById(modal);
$trigger.addEventListener('click', () => {
openModal($target);
});
});
// Add a click event on various child elements to close the parent modal
(document.querySelectorAll('.modal-background, .modal-close, .delete, .nf-modal-close') || []).forEach(($close) => {
const $target = $close.closest('.modal');
$close.addEventListener('click', () => {
closeModal($target);
});
});
// Add a keyboard event to close all modals
document.addEventListener('keydown', (event) => {
if (event.key === "Escape") {
closeAllModals();
}
});
}); });

View File

@@ -42,6 +42,7 @@ def task_deactivate_unchecked():
@celery_app.task(name="social_media.post_fedi") @celery_app.task(name="social_media.post_fedi")
def task_post_to_fedi(): def task_post_to_fedi():
adoption_notice = SocialMediaPost.get_an_to_post() adoption_notice = SocialMediaPost.get_an_to_post()
if adoption_notice is not None:
post_an_to_fedi(adoption_notice) post_an_to_fedi(adoption_notice)
set_timestamp("task_social_media.post_fedi") set_timestamp("task_social_media.post_fedi")

View File

@@ -0,0 +1,12 @@
{% load allauth %}
{% setvar variant %}
{% if "primary" in attrs.tags %}
is-success
{% elif "secondary" in attrs.tags %}
is-success is-light
{% endif %}
{% endsetvar %}
<span class="tag{% if variant %} {{ variant }}{% endif %}" {% if attrs.title %}title="{{ attrs.title }}"{% endif %}>
{% slot %}
{% endslot %}
</span>

View File

@@ -0,0 +1,15 @@
{% load allauth %}
{% comment %} djlint:off {% endcomment %}
<div class="control">
<{% if attrs.href %}a href="{{ attrs.href }}"{% else %}button{% endif %}
class="button is-primary"
{% if attrs.form %}form="{{ attrs.form }}"{% endif %}
{% if attrs.id %}id="{{ attrs.id }}"{% endif %}
{% if attrs.name %}name="{{ attrs.name }}"{% endif %}
{% if attrs.value %}value="{{ attrs.value }}"{% endif %}
{% if attrs.type %}type="{{ attrs.type }}"{% endif %}
>
{% slot %}
{% endslot %}
</{% if attrs.href %}a{% else %}button{% endif %}>
</div>

View File

@@ -0,0 +1,5 @@
{% load allauth %}
<div class="field is-grouped">
{% slot %}
{% endslot %}
</div>

View File

@@ -0,0 +1,50 @@
{% load allauth %}
<div class="field">
{% if attrs.type == "textarea" %}
<label class="label" for="{{ attrs.id }}">
{% slot label %}
{% endslot %}
</label>
<textarea class="textarea"
{% if attrs.required %}required{% endif %}
{% if attrs.rows %}rows="{{ attrs.rows }}"{% endif %}
{% if attrs.disabled %}disabled{% endif %}
{% if attrs.readonly %}readonly{% endif %}
{% if attrs.checked %}checked{% endif %}
{% if attrs.name %}name="{{ attrs.name }}"{% endif %}
{% if attrs.id %}id="{{ attrs.id }}"{% endif %}
{% if attrs.placeholder %}placeholder="{{ attrs.placeholder }}"{% endif %}>{% slot value %}{% endslot %}</textarea>
{% else %}
{% if attrs.type != "checkbox" and attrs.type != "radio" %}
<label class="label" for="{{ attrs.id }}">
{% slot label %}
{% endslot %}
</label>
{% endif %}
<input {% if attrs.type != "checkbox" and attrs.type != "radio" %}class="input"{% endif %}
{% if attrs.required %}required{% endif %}
{% if attrs.disabled %}disabled{% endif %}
{% if attrs.readonly %}readonly{% endif %}
{% if attrs.checked %}checked{% endif %}
{% if attrs.name %}name="{{ attrs.name }}"{% endif %}
{% if attrs.id %}id="{{ attrs.id }}"{% endif %}
{% if attrs.placeholder %}placeholder="{{ attrs.placeholder }}"{% endif %}
{% if attrs.autocomplete %}autocomplete="{{ attrs.autocomplete }}"{% endif %}
{% if attrs.value is not None %}value="{{ attrs.value }}"{% endif %}
type="{{ attrs.type }}">
{% if attrs.type == "checkbox" or attrs.type == "radio" %}
<label for="{{ attrs.id }}">
{% slot label %}
{% endslot %}
</label>
{% endif %}
{% endif %}
{% if slots.help_text %}
<p class="help is-danger">
{% slot help_text %}
{% endslot %}
</p>
{% endif %}
<p class="help is-danger">{{ attrs.errors }}</p>
</div>

View File

@@ -0,0 +1 @@
{{ attrs.form }}

View File

@@ -0,0 +1,12 @@
{% load allauth %}
<div class="block">
<form method="{{ attrs.method }}"
{% if attrs.action %}action="{{ attrs.action }}"{% endif %}>
{% slot body %}
{% endslot %}
<div class="field is-grouped is-grouped-multiline">
{% slot actions %}
{% endslot %}
</div>
</form>
</div>

View File

@@ -0,0 +1 @@
{% comment %} djlint:off {% endcomment %}{% load allauth %}<h1 class="title is-1">{% slot %}{% endslot %}</h1>

View File

@@ -0,0 +1 @@
{% comment %} djlint:off {% endcomment %}{% load allauth %}<h2 class="title is-2">{% slot %}{% endslot %}</h2>

View File

@@ -0,0 +1 @@
{% comment %} djlint:off {% endcomment %}{% load allauth %}<p class="content">{% slot %}{% endslot %}</p>

View File

@@ -0,0 +1,18 @@
{% load allauth %}
<section class="block">
<h2 class="title is-2">
{% slot title %}
{% endslot %}
</h2>
{% slot body %}
{% endslot %}
{% if slots.actions %}
<div class="field is-grouped is-grouped-multiline">
{% for action in slots.actions %}
<div class="control">
{{ action }}
</div>
{% endfor %}
</div>
{% endif %}
</section>

View File

@@ -0,0 +1 @@
{% extends "fellchensammlung/base.html" %}

View File

@@ -37,6 +37,26 @@
{% block header %} {% block header %}
{% include "fellchensammlung/header.html" %} {% include "fellchensammlung/header.html" %}
{% endblock %} {% endblock %}
{% if profile %}
<div class="profile">
<table class="table is-bordered is-fullwidth is-hoverable is-striped">
<thead>
<tr>
<td>Timestamp</td>
<td>Status</td>
</tr>
</thead>
<tbody>
{% for status in profile %}
<tr>
<td>{{ status.0 }}</td>
<td>{{ status.1 }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
<div class="main-content"> <div class="main-content">
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>
@@ -45,5 +65,8 @@
{% block footer %} {% block footer %}
{% include "fellchensammlung/footer.html" %} {% include "fellchensammlung/footer.html" %}
{% endblock %} {% endblock %}
{% block extra_body %}
{% endblock extra_body %}
</body> </body>
</html> </html>

View File

@@ -27,18 +27,13 @@
{% block content %} {% block content %}
{% include "fellchensammlung/partials/partial-adoption-notice-status.html" %} {% include "fellchensammlung/partials/partial-adoption-notice-status.html" %}
<div class="columns">
<div class="column is-two-thirds">
<!--- Title level (including action dropdown) --> <!--- Title level (including action dropdown) -->
<div class="level"> <div class="block is-flex is-justify-content-space-between">
<div class="level-left"> <div class="">
<div class="level-item"> <h2 class="title is-3 is-size-4-mobile">{{ adoption_notice.name }}</h2>
<p class="title is-3 is-size-4-mobile">{{ adoption_notice.name }}</p>
</div>
</div> </div>
<div class="level-right"> <div class="">
<div class="level-item">
<div class="dropdown is-right"> <div class="dropdown is-right">
<div class="dropdown-trigger"> <div class="dropdown-trigger">
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu4"> <button class="button" aria-haspopup="true" aria-controls="dropdown-menu4">
@@ -77,7 +72,6 @@
<hr class="dropdown-divider"> <hr class="dropdown-divider">
{% if has_edit_permission %} {% if has_edit_permission %}
<form class="dropdown-item" method="POST"> <form class="dropdown-item" method="POST">
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="action" value="checked_active"> <input type="hidden" name="action" value="checked_active">
@@ -113,6 +107,13 @@
aria-hidden="true"></i> {% trans 'Melden' %} aria-hidden="true"></i> {% trans 'Melden' %}
</a> </a>
{% if request.user.is_superuser %} {% if request.user.is_superuser %}
{% if oxitraffic_base_url %}
<hr class="dropdown-divider">
<a class="dropdown-item"
href="{{ oxitraffic_base_url }}/stats?path={{ adoption_notice.get_absolute_url }}">
<i class="fas fa-chart-line fa-fw"></i> {% trans 'Aufrufe' %}
</a>
{% endif %}
<hr class="dropdown-divider"> <hr class="dropdown-divider">
<a class="dropdown-item is-warning" <a class="dropdown-item is-warning"
href="{% url adoption_notice_meta|admin_urlname:'change' adoption_notice.pk %}"> href="{% url adoption_notice_meta|admin_urlname:'change' adoption_notice.pk %}">
@@ -124,7 +125,8 @@
</div> </div>
</div> </div>
</div> </div>
</div> <div class="columns">
<div class="column is-two-thirds">
<!--- General Information ---> <!--- General Information --->
<div class="grid"> <div class="grid">
<div class="cell"> <div class="cell">
@@ -157,7 +159,7 @@
</div> </div>
<!--- Images and Description ---> <!--- Images and Description --->
<div class="columns"> <div class="columns block">
<!--- Images ---> <!--- Images --->
{% if adoption_notice.get_photos %} {% if adoption_notice.get_photos %}
<div class="column block"> <div class="column block">
@@ -218,12 +220,16 @@
</div> </div>
</div> </div>
</div> </div>
<div class="block">
{% include 'fellchensammlung/partials/adoption_process/base.html' %}
</div>
<div class="block"> <div class="block">
{% if adoption_notice.further_information %} {% if adoption_notice.further_information %}
<form method="get" action="{% url 'external-site' %}"> <form method="get" action="{% url 'external-site' %}">
<input type="hidden" name="url" value="{{ adoption_notice.further_information }}"> <input type="hidden" name="url" value="{{ adoption_notice.further_information }}">
<button class="button is-primary is-fullwidth" type="submit" id="submit"> <button class="button is-warning is-fullwidth" type="submit" id="submit">
{{ adoption_notice.further_information | domain }} <i {% translate 'Weitere Informationen' %}: {{ adoption_notice.further_information | domain }}
<i
class="fa-solid fa-arrow-up-right-from-square fa-fw"></i> class="fa-solid fa-arrow-up-right-from-square fa-fw"></i>
</button> </button>
</form> </form>
@@ -238,7 +244,7 @@
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
<hr>
<div class="block"> <div class="block">

View File

@@ -19,53 +19,10 @@
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<div class="block"> <div class="block">
<div class="card"> {% include "fellchensammlung/partials/rescue_orgs/partial-basic-info-card.html" %}
<div class="card-header">
<h1 class="card-header-title">{{ org.name }}</h1>
</div>
<div class="card-content">
<div class="block">
<b><i class="fa-solid fa-location-dot"></i></b>
{% if org.location %}
{{ org.location }}
{% else %}
{{ org.location_string }}
{% endif %}
{% if org.description %}
<div class="block content">
<p>{{ org.description | render_markdown }}</p>
</div>
{% endif %}
</div>
{% if org.specializations %}
<div class="block">
<h3 class="title is-5">{% translate 'Spezialisierung' %}</h3>
<div class="content">
<ul>
{% for specialization in org.specializations.all %}
<li>{{ specialization }}</li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
{% if org.parent_org %}
<div class="block">
<h3 class="title is-5">{% translate 'Übergeordnete Organisation' %}</h3>
<p>
<span>
<i class="fa-solid fa-building fa-fw"
aria-label="{% trans 'Tierschutzorganisation' %}"></i>
<a href="{{ org.parent_org.get_absolute_url }}"> {{ org.parent_org }}</a>
</span>
</p>
</div>
{% endif %}
</div>
</div>
</div> </div>
<div class="block"> <div class="block">
{% include "fellchensammlung/partials/partial-rescue-organization-contact.html" %} {% include "fellchensammlung/partials/rescue_orgs/partial-rescue-organization-contact.html" %}
</div> </div>
<div class="block"> <div class="block">
<a class="button is-warning is-fullwidth" href="{% url org_meta|admin_urlname:'change' org.pk %}"> <a class="button is-warning is-fullwidth" href="{% url org_meta|admin_urlname:'change' org.pk %}">

View File

@@ -1,7 +1,8 @@
{% extends "fellchensammlung/base.html" %} {% extends "fellchensammlung/base.html" %}
{% load i18n %} {% load i18n %}
{% load account %}
{% block title %}<title>{{ user.get_full_name }}</title>{% endblock %} {% block title %}<title>{% user_display user %}</title>{% endblock %}
{% block content %} {% block content %}
@@ -13,7 +14,7 @@
</div> </div>
<div class="level-right"> <div class="level-right">
<div class="level-item"> <div class="level-item">
<form class="" action="{% url 'logout' %}" method="post"> <form class="" action="{% url 'account_logout' %}" method="post">
{% csrf_token %} {% csrf_token %}
<button class="button" type="submit"> <button class="button" type="submit">
<i aria-hidden="true" class="fas fa-sign-out fa-fw"></i> Logout <i aria-hidden="true" class="fas fa-sign-out fa-fw"></i> Logout
@@ -25,12 +26,30 @@
<div class="block"> <div class="block">
<h2 class="title is-2">{% trans 'Profil verwalten' %}</h2> <h2 class="title is-2">{% trans 'Profil verwalten' %}</h2>
<p><strong>{% translate "E-Mail" %}:</strong> {{ user.email }}</p> <div class="block"><strong>{% translate "E-Mail" %}:</strong> {{ user.email }}</div>
<div class=""> <div class="block">
<p> <div class="field is-grouped is-grouped-multiline">
<a class="button is-warning" href="{% url 'password_change' %}">{% translate "Change password" %}</a> <div class="control">
<a class="button is-info" href="{% url 'user-me-export' %}">{% translate "Daten exportieren" %}</a> <a class="button is-warning"
</p> href="{% url 'account_change_password' %}">{% translate "Passwort ändern" %}</a>
</div>
<div class="control">
<a class="button is-warning"
href="{% url 'account_email' %}">
{% translate "E-Mail Adresse ändern" %}
</a>
</div>
<div class="control">
<a class="button is-warning"
href="{% url 'mfa_index' %}">
{% translate "2-Faktor Authentifizierung" %}
</a>
</div>
<div class="control">
<a class="button is-info" href="{% url 'user-me-export' %}">
{% translate "Daten exportieren" %}
</a>
</div>
</div> </div>
</div> </div>

View File

@@ -0,0 +1,52 @@
{% load custom_tags %}
{% load i18n %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% block title %}{% endblock %}
{% block og_title %}{% endblock %}
{% block description %}{% endblock %}
{% block og_description %}{% endblock %}
{% block og_image %}{% endblock %}
<link rel="canonical" href="{% block canonical_url %}{% endblock %}">
<!-- Add additional CSS in static file -->
<link rel="stylesheet" href="{% static 'fellchensammlung/css/main.css' %}">
<link rel="stylesheet" href="{% static 'fellchensammlung/css/photoswipe.css' %}">
<link href="{% static 'fontawesomefree/css/fontawesome.css' %}" rel="stylesheet" type="text/css">
<link href="{% static 'fontawesomefree/css/brands.css' %}" rel="stylesheet" type="text/css">
<link href="{% static 'fontawesomefree/css/solid.css' %}" rel="stylesheet" type="text/css">
{% if background_color %}
<style>
body {
background: #{{ background_color }};
}
</style>
{% endif %}
<script src="{% static 'fellchensammlung/js/custom.js' %}"></script>
<script src="{% static 'fellchensammlung/js/toggles.js' %}"></script>
<script src="{% static 'fellchensammlung/js/jquery.min.js' %}"></script>
<script type="module" src="{% static 'fellchensammlung/js/photoswipe.js' %}"></script>
{% block additional_scrips %}{% endblock %}
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'fellchensammlung/favicon/apple-touch-icon.png' %}">
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'fellchensammlung/favicon/favicon-32x32.png' %}">
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'fellchensammlung/favicon/favicon-16x16.png' %}">
{% get_oxitraffic_script_if_enabled %}
<base target="_parent"/>
</head>
<body>
<div class="embed-main-content">
{% block content %}{% endblock %}
</div>
</body>
</html>

View File

@@ -0,0 +1,10 @@
{% extends "fellchensammlung/embeddables/embedding-base.html" %}
{% load custom_tags %}
{% load i18n %}
{% block content %}
<div class="block">
{% include "fellchensammlung/lists/list-adoption-notices.html" %}
</div>
{% endblock %}

View File

@@ -2,7 +2,7 @@
{% load i18n %} {% load i18n %}
{% load custom_tags %} {% load custom_tags %}
{% block title %}<title>{% translate "403 Forbidden" %}</title>{% endblock %} {% block title %}<title>{% translate "404 Forbidden" %}</title>{% endblock %}
{% block content %} {% block content %}
<h1 class="title is-1">404 Not Found</h1> <h1 class="title is-1">404 Not Found</h1>

View File

@@ -34,6 +34,10 @@
{% translate 'Das Notfellchen Projekt' %} {% translate 'Das Notfellchen Projekt' %}
</a> </a>
<br/> <br/>
<a href="{% url "contact" %}">
{% translate 'Kontakt' %}
</a>
<br/>
<a href="{% url "buying" %}"> <a href="{% url "buying" %}">
{% translate 'Ratten kaufen' %} {% translate 'Ratten kaufen' %}
</a> </a>

View File

@@ -81,6 +81,20 @@
</div> </div>
</div> </div>
<div class="field">
<label class="label" for="an-organization">
{{ form.organization.label }}
{% if form.organization.field.required %}<span class="special_class">*</span>{% endif %}
</label>
<div class="select">
{{ form.organization|attr:"id:an-organization" }}
</div>
<div class="help">
{{ form.organization.help_text }}
</div>
</div>
<div class="notification is-info"> <div class="notification is-info">
<p> <p>

View File

@@ -1,19 +1,13 @@
{% load i18n %} {% load i18n %}
{% load widget_tweaks %}
<div class="card"> <form method="POST">
<div class="card-header">
<div class="card-header-title">
{% blocktrans %}
Als {{ user }} kommentieren
{% endblocktrans %}
</div>
</div>
<div class="card-content">
<form method="POST">
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="action" value="comment"> <input type="hidden" name="action" value="comment">
{{ comment_form }} <div class="field">
<input type="submit" class="button is-primary" value="{% trans 'Kommentieren' %}"> {{ comment_form.text |add_class:"input textarea"|attr:"rows:3"|attr:"placeholder:Neuer Kommentar" }}
</form>
</div> </div>
</div> <div class="control">
<input type="submit" class="button is-primary" value="{% trans 'Kommentieren' %}">
</div>
</form>

View File

@@ -0,0 +1,35 @@
{% extends "fellchensammlung/base.html" %}
{% load i18n %}
{% load widget_tweaks %}
{% load admin_urls %}
{% block title %}
<title>Organisation {{ org }} von regelmäßiger Prüfung ausschließen</title>
{% endblock %}
{% block content %}
<h1 class="title is-1">Organisation {{ org }} von regelmäßiger Prüfung ausschließen</h1>
<div class="columns block">
<div class="column">
{% include "fellchensammlung/partials/rescue_orgs/partial-basic-info-card.html" %}
</div>
<div class="column">
{% include "fellchensammlung/partials/rescue_orgs/partial-rescue-organization-contact.html" %}
</div>
</div>
<div class="block">
<form method="post">
{% csrf_token %}
{{ form }}
<input class="button is-primary" type="submit" name="delete"
value="{% translate "Aktualisieren" %}">
<a class="button" href="{% url 'organization-check' %}">{% translate "Zurück" %}</a>
</form>
</div>
<div class="block">
<a class="button is-warning is-fullwidth" href="{% url org_meta|admin_urlname:'change' org.pk %}">
<i class="fa-solid fa-tools fa-fw"></i> Admin interface
</a>
</div>
{% endblock %}

View File

@@ -4,26 +4,84 @@
{% load widget_tweaks %} {% load widget_tweaks %}
{% block content %} {% block content %}
<div> <div class="block">
<p>
{% blocktranslate %} {% blocktranslate %}
Lade hier ein Foto hoch - wähle den Titel wie du willst und mach bitte eine Bildbeschreibung, Lade hier ein Foto hoch. Füge bitte eine Bildbeschreibung hinzu,
damit die Fotos auch für blinde und sehbehinderte Personen zugänglich sind. damit die Fotos auch für blinde und sehbehinderte Personen zugänglich sind.
{% endblocktranslate %} {% endblocktranslate %}
<p><a class="button" target="_blank"
href="https://www.dbsv.org/bildbeschreibung-4-regeln.html">{% translate 'Anleitung für Bildbeschreibungen' %}</a>
</p> </p>
</div> </div>
<div class="block">
<form method="post" enctype="multipart/form-data"> <form method="post" enctype="multipart/form-data">
{% csrf_token %} {% csrf_token %}
<div class="field"> <div class="file has-name is-boxed is-primary is-">
<label class="label" for="image">{{ form.image.label }}</label> <label class="file-label" for="image">
{{ form.image|add_class:"input"|attr:"id:image" }} {{ form.image|add_class:"file-input"|attr:"id:image" }}
<span class="file-cta">
<span class="file-icon">
<i class="fas fa-upload"></i>
</span>
<span class="file-label">{{ form.image.help_text }}</span>
</span>
<span class="file-name" id="image-upload-filename">...</span>
</label>
</div> </div>
<!--- Image Preview: Only shown if image gets selected --->
<div class="field" id="image-preview-wrapper" style="display: none;">
<label class="label">{% translate "Vorschau" %}</label>
<div class="box has-text-centered">
<figure class="image is-256x256 is-inline-block">
<img id="image-preview" src="" alt="{% translate 'Bildvorschau' %}" class="is-rounded">
</figure>
</div>
</div>
<div class="field"> <div class="field">
<label class="label" for="alt-text">{{ form.alt_text.label }}</label> <label class="label" for="alt-text">{{ form.alt_text.label }}</label>
{{ form.alt_text|add_class:"textarea"|attr:"id:alt-text"|attr:"rows:3" }} {{ form.alt_text|add_class:"textarea"|attr:"id:alt-text"|attr:"rows:3" }}
<div class="help">
{{ form.alt_text.help_text }}
</div>
<div class="is-danger">{{ form.alt_text.errors }}</div> <div class="is-danger">{{ form.alt_text.errors }}</div>
</div> </div>
<input class="button is-primary" type="submit" value="{% translate "Speichern" %}"> <input class="button is-primary" type="submit" value="{% translate "Speichern" %}">
</form> </form>
</div>
<div class="block">
<a class="button is-info is-warning is-fullwidth" target="_blank"
href="https://www.dbsv.org/bildbeschreibung-4-regeln.html">
<i class="fa-solid fa-link fa-fw"></i> {% translate 'Anleitung für Bildbeschreibungen' %}
</a>
</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
const input = document.getElementById("image");
const previewWrapper = document.getElementById("image-preview-wrapper");
const preview = document.getElementById("image-preview");
const filename = document.getElementById("image-upload-filename");
input.addEventListener("change", function () {
const file = this.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function (e) {
preview.src = e.target.result;
previewWrapper.style.display = "block";
filename.innerText = file.name;
}
reader.readAsDataURL(file);
} else {
preview.src = "";
previewWrapper.style.display = "none";
}
});
});
</script>
{% endblock %} {% endblock %}

View File

@@ -27,7 +27,7 @@
{{ field|add_class:"input" }} {{ field|add_class:"input" }}
{% endif %} {% endif %}
</div> </div>
<div class="help"> <div class="help content">
{{ field.help_text }} {{ field.help_text }}
</div> </div>
<div class="help is-danger"> <div class="help is-danger">

View File

@@ -49,10 +49,10 @@
{% else %} {% else %}
<div class="navbar-item"> <div class="navbar-item">
<div class="buttons"> <div class="buttons">
<a class="button is-primary" href="{% url "django_registration_register" %}"> <a class="button is-primary" href="{% url "account_signup" %}">
<strong>{% translate "Registrieren" %}</strong> <strong>{% translate "Registrieren" %}</strong>
</a> </a>
<a class="button is-light" href="{% url "login" %}"> <a class="button is-light" href="{% url "account_login" %}">
<strong>{% translate "Login" %}</strong> <strong>{% translate "Login" %}</strong>
</a> </a>
</div> </div>

View File

@@ -0,0 +1,171 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="264.58334mm"
height="264.58334mm"
viewBox="0 0 264.58334 264.58334"
version="1.1"
id="svg1"
xml:space="preserve"
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
sodipodi:docname="drawing.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
inkscape:zoom="0.51136354"
inkscape:cx="1504.8003"
inkscape:cy="472.26675"
inkscape:window-width="2048"
inkscape:window-height="1208"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:page
x="0"
y="0"
width="264.58334"
height="264.58334"
id="page1"
margin="0"
bleed="0"/>
<inkscape:page
x="274.58334"
y="0"
width="264.58334"
height="264.58334"
id="page2"
margin="0"
bleed="0"/>
<inkscape:page
x="549.16669"
y="0"
width="264.58334"
height="264.58334"
id="page4"
margin="0"
bleed="0"/>
</sodipodi:namedview>
<defs id="defs1"/>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#6cd4ff;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;fill-opacity:0.73333335"
id="rect1"
width="264.58337"
height="264.58337"
x="0"
y="0"/>
<rect
style="fill:#6cd4ff;fill-opacity:0.733333;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
id="rect1-2"
width="264.58337"
height="264.58337"
x="274.58334"
y="0"/>
<rect
style="fill:#6cd4ff;fill-opacity:0.733333;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
id="rect1-0"
width="264.58337"
height="264.58337"
x="549.16669"
y="0"/>
<text
xml:space="preserve"
style="font-size:19.7556px;line-height:1.3;font-family:'Latin Modern Mono';-inkscape-font-specification:'Latin Modern Mono, Normal';text-align:start;letter-spacing:0px;word-spacing:-0.574146px;writing-mode:lr-tb;direction:ltr;text-anchor:start;white-space:pre;inline-size:230.276;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
x="16.116602"
y="81.350471"
id="text4"
transform="translate(-7.9696277,63.01184)"><tspan
x="16.116602"
y="81.350471"
id="tspan2">{{ adoption_notice.short_description }}</tspan></text>
<rect
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:3.17108;stroke-linecap:round;stroke-linejoin:round"
id="rect4"
width="192.30475"
height="93.450798"
x="42.798157"
y="14.846257"/>
<text
xml:space="preserve"
style="font-size:19.7556px;line-height:1.1;font-family:'Latin Modern Mono';-inkscape-font-specification:'Latin Modern Mono, Normal';text-align:start;letter-spacing:0px;word-spacing:-0.79286px;writing-mode:lr-tb;direction:ltr;text-anchor:start;white-space:pre;inline-size:192.796;fill:#000000;fill-opacity:0.733333;stroke:none;stroke-width:2.76188;stroke-linecap:round;stroke-linejoin:round"
x="98.301682"
y="49.274101"
id="text1"
transform="translate(-58.467048,-14.731528)"><tspan
x="98.301682"
y="49.274101"
id="tspan4"><tspan
dx="0 0.79285997 -0.79286003 0 0 0 0 0 0.79285902 -0.79285526 0 0.79285902"
style="text-align:center;text-anchor:middle"
id="tspan3">{{ adoption_notice.name }}</tspan>
</tspan>
</text>
<rect
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
id="rect4-8"
width="175.74771"
height="40.675236"
x="309.5625"
y="17.4625"/>
<text
xml:space="preserve"
style="font-size:36.6612px;line-height:1.3;font-family:'Latin Modern Mono';-inkscape-font-specification:'Latin Modern Mono, Normal';text-align:start;letter-spacing:0px;word-spacing:-1.06546px;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#000000;fill-opacity:0.733333;stroke:none;stroke-width:3.71147;stroke-linecap:round;stroke-linejoin:round"
x="328.02808"
y="47.813782"
id="text1-7">
<tspan
sodipodi:role="line"
id="tspan1-9"
style="fill:#000000;fill-opacity:0.733333;stroke-width:3.71147"
x="328.02808"
y="47.813782">
Ratte 1
</tspan>
</text>
<rect
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
id="rect4-7"
width="175.74771"
height="40.675236"
x="597.69373"
y="18.520834"/>
<text
xml:space="preserve"
style="font-size:36.6612px;line-height:1.3;font-family:'Latin Modern Mono';-inkscape-font-specification:'Latin Modern Mono, Normal';text-align:start;letter-spacing:0px;word-spacing:-1.06546px;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#000000;fill-opacity:0.733333;stroke:none;stroke-width:3.71147;stroke-linecap:round;stroke-linejoin:round"
x="616.1593"
y="48.872116"
id="text1-5">
<tspan
sodipodi:role="line"
id="tspan1-92"
style="fill:#000000;fill-opacity:0.733333;stroke-width:3.71147"
x="616.1593"
y="48.872116">Ratte 2</tspan>
</text>
<image
width="116.45744"
height="145.62663"
preserveAspectRatio="none"
xlink:href="data:image/jpeg;base64,{{ adoption_notice.get_photo.as_base64 }};"
id="image1"
x="339.55661"
y="87.612373"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@@ -3,10 +3,23 @@
<div class="grid is-col-min-10"> <div class="grid is-col-min-10">
{% for adoption_notice in adoption_notices %} {% for adoption_notice in adoption_notices %}
<div class="cell"> <div class="cell">
{% if expand %}
{% include "fellchensammlung/partials/partial-adoption-notice.html" %}
{% else %}
{% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %} {% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %}
{% endif %}
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
{% else %} {% else %}
<article class="message is-warning">
<div class="message-header">
<p>{% translate "Keine Vermittlungen gefunden." %}</p> <p>{% translate "Keine Vermittlungen gefunden." %}</p>
</div>
<div class="message-body">
{% blocktranslate %}
Versuche es zu einem späteren Zeitpunkt erneut.
{% endblocktranslate %}
</div>
</article>
{% endif %} {% endif %}

View File

@@ -3,7 +3,7 @@
{% if rescue_organizations %} {% if rescue_organizations %}
{% for rescue_organization in rescue_organizations %} {% for rescue_organization in rescue_organizations %}
<div class="cell"> <div class="cell">
{% include "fellchensammlung/partials/partial-rescue-organization.html" %} {% include "fellchensammlung/partials/rescue_orgs/partial-rescue-organization.html" %}
</div> </div>
{% endfor %} {% endfor %}
{% else %} {% else %}

View File

@@ -11,12 +11,12 @@
<div class="control"> <div class="control">
<div class="select"> <div class="select">
<select id="reason_for_closing" name="reason_for_closing"> <select id="reason_for_closing" name="reason_for_closing">
<option value="successful_with_notfellchen">{% translate 'Vermittelt mit Hilfe von Notfellchen' %}</option> <option value="closed_successful_with_notfellchen">{% translate 'Vermittelt mit Hilfe von Notfellchen' %}</option>
<option value="successful_without_notfellchen">{% translate 'Vermittelt ohne Hilfe von Notfellchen' %}</option> <option value="closed_successful_without_notfellchen">{% translate 'Vermittelt ohne Hilfe von Notfellchen' %}</option>
<option value="closed_for_other_adoption_notice">{% translate 'Vermittlung zugunsten einer anderen geschlossen' %}</option> <option value="closed_for_other_adoption_notice">{% translate 'Vermittlung zugunsten einer anderen geschlossen' %}</option>
<option value="not_open_for_adoption_anymore">{% translate 'Nicht mehr zu vermitteln (z.B. aufgrund von Krankheit)' %}</option> <option value="closed_not_open_for_adoption_anymore">{% translate 'Nicht mehr zu vermitteln (z.B. aufgrund von Krankheit)' %}</option>
<option value="animal_died">{% translate 'Tod des Tiers' %}</option> <option value="closed_animal_died">{% translate 'Tod des Tiers' %}</option>
<option value="other">{% translate 'Anderer Grund' %}</option> <option value="closed_other">{% translate 'Anderer Grund' %}</option>
</select> </select>
</div> </div>
</div> </div>

View File

@@ -0,0 +1,16 @@
{% load custom_tags %}
{% load i18n %}
<div class="card">
<div class="card-header">
<h2 class="card-header-title">
{% translate 'Adoptionsprozess' %}
</h2>
</div>
<div class="card-content">
{% include adoption_process_template %}
</div>
</div>

View File

@@ -0,0 +1,7 @@
{% load i18n %}
<div class="content">
{% translate 'Kontaktiere die Person mit den Kontaktdaten in der Beschreibung.' %}
</div>

View File

@@ -0,0 +1,31 @@
{% load i18n %}
<div class="content">
<ol class="adoption-process">
{% if adoption_notice.organization %}
{% if adoption_notice.further_information %}
<li>{% translate 'Link zu "Weiteren Informationen" prüfen' %}</li>
{% endif %}
<li>
{% translate 'Organization kontaktieren' %}<br>
<a class="button is-info is-small is-fullwidth"
href="{{ adoption_notice.organization.get_absolute_url }}">
{% translate 'Kontaktdaten' %}
</a>
</li>
<li>{% translate 'Bei erfolgreicher Vermittlung: Vermittlung als geschlossen melden' %}</li>
{% else %}
{% if adoption_notice.further_information %}
<li>{% translate 'Link zu "Weiteren Informationen" prüfen' %}</li>
<li>{% translate 'Person, die die Vermittlung eingestellt hat, kontaktieren' %}</li>
{% else %}
<li>
{% translate 'Person, die die Vermittlung eingestellt hat, per Kommentar kontaktieren' %}
</li>
{% endif %}
<li>{% translate 'Bei erfolgreicher Vermittlung: Vermittlung als geschlossen melden' %}</li>
{% endif %}
</ol>
</div>

View File

@@ -0,0 +1,30 @@
{% load i18n %}
<div id="modal-shortcuts" class="modal">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">{% trans 'Shortcuts' %}</p>
<button class="delete" aria-label="{% trans 'Schließen' %}"></button>
</header>
<section class="modal-card-body">
<div class="content">
<ul>
<li>{% trans 'Website öffnen' %}: <code>O</code></li>
<li>{% trans 'Website schließen' %}: <code>{% trans 'STRG' %} + W</code></li>
<li>{% trans 'Organisation als geprüft markieren' %}: <code>{% trans 'STRG' %} + W</code></li>
</ul>
</div>
</section>
<footer class="modal-card-foot">
<div class="buttons">
<button class="button is-success nf-modal-close">{% translate 'Verstanden' %}</button>
<button class="button">{% translate 'Details' %}</button>
</div>
</footer>
</div>
</div>
<button class="button is-info floating js-modal-trigger" data-target="modal-shortcuts">
<i class="fa-solid fa-keyboard fa-fw"></i> {% trans 'Shortcuts' %}
</button>

View File

@@ -54,7 +54,7 @@
</a> </a>
</div> </div>
{% endwith %} {% endwith %}
{% if adoption_notice.get_photos|length > 1 %}
<div class="thumbnail-row minimal"> <div class="thumbnail-row minimal">
{% for photo in adoption_notice.get_photos|slice:"1:4" %} {% for photo in adoption_notice.get_photos|slice:"1:4" %}
<div class="thumbnail"> <div class="thumbnail">
@@ -68,6 +68,13 @@
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
{% else %}
{% if adoption_notice.description_100_short %}
<div class="content">
{{ adoption_notice.description_100_short | render_markdown }}
</div>
{% endif %}
{% endif %}
</div> </div>
{% else %} {% else %}
{% if adoption_notice.description_short %} {% if adoption_notice.description_short %}

View File

@@ -4,14 +4,10 @@
{% if adoption_notice.is_closed %} {% if adoption_notice.is_closed %}
<article class="message is-warning"> <article class="message is-warning">
<div class="message-header"> <div class="message-header">
<p>{% translate 'Vermittlung deaktiviert' %}</p> <p>{% translate 'Vermittlung geschlossen' %}</p>
</div> </div>
<div class="message-body content"> <div class="message-body content">
{% blocktranslate %} {{ adoption_notice.status_description }}
Diese Vermittlung wurde deaktiviert. Typischerweise passiert das, wenn die Tiere erfolgreich
vermittelt wurden.
In den Kommentaren findest du ggf. mehr Informationen.
{% endblocktranslate %}
</div> </div>
</article> </article>
{% elif adoption_notice.is_interested %} {% elif adoption_notice.is_interested %}
@@ -29,14 +25,10 @@
{% elif adoption_notice.is_awaiting_action %} {% elif adoption_notice.is_awaiting_action %}
<article class="message is-warning"> <article class="message is-warning">
<div class="message-header"> <div class="message-header">
<p>{% translate 'Warten auf Aktivierung' %}</p> <p>{% translate 'Wartet auf Freigabe von Moderator*innen' %}</p>
</div> </div>
<div class="message-body content"> <div class="message-body content">
{% blocktranslate %} {{ adoption_notice.status_description }}
Diese Vermittlung muss noch durch Moderator*innen aktiviert werden und taucht daher nicht auf der
Startseite auf.
Ggf. fehlen noch relevante Informationen.
{% endblocktranslate %}
</div> </div>
</article> </article>
{% endif %} {% endif %}

View File

@@ -1,40 +1,84 @@
{% load custom_tags %} {% load custom_tags %}
{% load i18n %} {% load i18n %}
<div class="card an-card">
<div class="card"> <div class="card-header">
<div> <h2 class="card-header-title">
<div class="header-card-adoption-notice"> <a href="{{ adoption_notice.get_absolute_url }}"> {{ adoption_notice.name }}</a>
<h1><a class="heading-card-adoption-notice" </h2>
href="{{ adoption_notice.get_absolute_url }}"> {{ adoption_notice.name }}</a></h1>
<a class="adoption-card-report-link" href="{{ adoption_notice.get_report_url }}"><i
class="fa-solid fa-flag"></i></a>
</div> </div>
<p><b>{% translate "Notfellchen" %}:</b> {{ adoption_notice.animals.all|join_link:", " | safe }} <div class="card-content">
</p> <div class="grid">
<div class="cell">
<!--- General Information --->
<div class="grid">
<div class="cell">
{% if adoption_notice.organization %}
<div class="cell">
<span>
<i class="fa-solid fa-building fa-fw" aria-label="{% trans 'Tierschutzorganisation' %}"></i>
<a href="{{ adoption_notice.organization.get_absolute_url }}"> {{ adoption_notice.organization }}</a>
</span>
</div>
{% else %}
<p> <p>
<b>Ort</b> <i class="fa-solid fa-location-dot fa-fw"></i>
{% if adoption_notice.location %} {% if adoption_notice.location %}
{{ adoption_notice.location.str }} {{ adoption_notice.location }}
{% else %} {% else %}
{{ adoption_notice.location_string }} {{ adoption_notice.location_string }}
{% endif %} {% endif %}
</p> </p>
<div class="content">
{% if adoption_notice.description %}
{{ adoption_notice.description | render_markdown }}
{% else %}
<p>
{% translate "Keine Beschreibung" %}
</p>
{% endif %} {% endif %}
</div> </div>
{% if adoption_notice.get_photo %} <div class="cell">
<div class="adoption-notice-img"> {% include "fellchensammlung/partials/sex-overview.html" %}
<img src="{{ MEDIA_URL }}/{{ adoption_notice.get_photo.image }}" </div>
alt="{{ adoption_notice.get_photo.alt_text }}"> </div>
</div>
</div>
{% if adoption_notice.get_photos %}
<!--- Images -->
<div class="gallery block">
{% with photo=adoption_notice.get_photos.0 %}
<div class="main-photo minimal">
<a href="{{ MEDIA_URL }}{{ photo.image }}"
data-pswp-width="{{ photo.image.width }}"
data-pswp-height="{{ photo.image.height }}"
target="_blank">
<img src="{{ MEDIA_URL }}{{ photo.image }}"
alt="{{ photo.alt_text }}">
</a>
</div>
{% endwith %}
{% if adoption_notice.get_photos|length > 1 %}
<div class="thumbnail-row minimal">
{% for photo in adoption_notice.get_photos|slice:"1:4" %}
<div class="thumbnail">
<a href="{{ MEDIA_URL }}{{ photo.image }}"
data-pswp-width="{{ photo.image.width }}"
data-pswp-height="{{ photo.image.height }}"
target="_blank">
<img src="{{ MEDIA_URL }}{{ photo.image }}"
alt="{{ photo.alt_text }}">
</a>
</div>
{% endfor %}
</div>
</div>
{% endif %}
{% endif %}
<!--- Description -->
{% if adoption_notice.description_short %}
<div class="content block">
{{ adoption_notice.description_short | render_markdown }}
</div> </div>
{% else %}
{% translate "Keine Foto" %}
{% endif %} {% endif %}
</div> </div>
</div> </div>

View File

@@ -12,14 +12,13 @@
{% else %} {% else %}
<p class="is-italic">{% translate 'Noch keine Kommentare' %}</p> <p class="is-italic">{% translate 'Noch keine Kommentare' %}</p>
{% endif %} {% endif %}
</div>
</div>
<div class="block">
{% if user.is_authenticated %} {% if user.is_authenticated %}
<hr>
{% include "fellchensammlung/forms/form-comment.html" %} {% include "fellchensammlung/forms/form-comment.html" %}
{% else %} {% else %}
<p class="card-footer-item"> <div class="card-footer-item">
{% translate 'Du musst dich einloggen um Kommentare zu hinterlassen' %} {% translate 'Du musst dich einloggen um Kommentare zu hinterlassen' %}
</p> </div>
{% endif %} {% endif %}
</div>
</div> </div>

View File

@@ -0,0 +1,55 @@
{% load i18n %}
{% if org.website %}
<a class="panel-block is-active" href="{{ org.website }}" target="_blank">
<span class="panel-icon">
<i class="fas fa-globe" aria-label="{% translate "Website" %}"></i>
</span>
{{ org.website }}
</a>
{% endif %}
{% if org.phone_number %}
<a class="panel-block is-active" href="tel:{{ org.phone_number }}">
<span class="panel-icon">
<i class="fas fa-phone" aria-label="{% translate "Telefonnummer" %}"></i>
</span>
{{ org.phone_number }}
</a>
{% endif %}
{% if org.email %}
<a class="panel-block is-active" href="mailto:{{ org.email }}">
<span class="panel-icon">
<i class="fas fa-envelope" aria-label="{% translate "E-Mail" %}"></i>
</span>
{{ org.email }}
</a>
{% endif %}
{% if org.fediverse_profile %}
<a class="panel-block is-active" href="{{ org.fediverse_profile }}" target="_blank">
<span class="panel-icon">
<i class="fas fa-hashtag" aria-label="{% translate "Fediverse Profil" %}"></i>
</span>
{{ org.fediverse_profile }}
</a>
{% endif %}
{% if org.instagram %}
<a class="panel-block is-active" href="{{ org.instagram }}" target="_blank">
<span class="panel-icon">
<i class="fa-brands fa-instagram" aria-label="{% translate "Instagram Profil" %}"></i>
</span>
{{ org.instagram }}
</a>
{% endif %}
{% if org.facebook %}
<a class="panel-block is-active" href="{{ org.facebook }}" target="_blank">
<span class="panel-icon">
<i class="fa-brands fa-facebook" aria-label="{% translate "Facebook Profil" %}"></i>
</span>
{{ org.facebook }}
</a>
{% endif %}

View File

@@ -1,65 +0,0 @@
{% load custom_tags %}
{% load i18n %}
<div class="panel block">
<p class="panel-heading">{% trans "Kontaktdaten" %}</p>
{% if org.has_contact_data %}
{% if org.website %}
<a class="panel-block is-active" href="{{ org.website }}" target="_blank">
<span class="panel-icon">
<i class="fas fa-globe" aria-label="{% translate "Website" %}"></i>
</span>
{{ org.website }}
</a>
{% endif %}
{% if org.phone_number %}
<a class="panel-block is-active" href="tel:{{ org.phone_number }}">
<span class="panel-icon">
<i class="fas fa-phone" aria-label="{% translate "Telefonnummer" %}"></i>
</span>
{{ org.phone_number }}
</a>
{% endif %}
{% if org.email %}
<a class="panel-block is-active" href="mailto:{{ org.email }}">
<span class="panel-icon">
<i class="fas fa-envelope" aria-label="{% translate "E-Mail" %}"></i>
</span>
{{ org.email }}
</a>
{% endif %}
{% if org.fediverse_profile %}
<a class="panel-block is-active" href="{{ org.fediverse_profile }}" target="_blank">
<span class="panel-icon">
<i class="fas fa-hashtag" aria-label="{% translate "Fediverse Profil" %}"></i>
</span>
{{ org.fediverse_profile }}
</a>
{% endif %}
{% if org.instagram %}
<a class="panel-block is-active" href="{{ org.instagram }}" target="_blank">
<span class="panel-icon">
<i class="fa-brands fa-instagram" aria-label="{% translate "Instagram Profil" %}"></i>
</span>
{{ org.instagram }}
</a>
{% endif %}
{% if org.facebook %}
<a class="panel-block is-active" href="{{ org.facebook }}" target="_blank">
<span class="panel-icon">
<i class="fa-brands fa-facebook" aria-label="{% translate "Facebook Profil" %}"></i>
</span>
{{ org.facebook }}
</a>
{% endif %}
{% else %}
<div class="panel-block is-active">
<span class="panel-icon">
<i class="fas fa-x" aria-label="{% translate "E-Mail" %}"></i>
</span>
{% translate 'Keine Kontaktdaten hinterlegt' %}
</div>
{% endif %}
</div>

View File

@@ -0,0 +1,46 @@
{% load i18n %}
{% load custom_tags %}
<div class="card">
<div class="card-header">
<h1 class="card-header-title">{{ org.name }}</h1>
</div>
<div class="card-content">
<div class="block">
<b><i class="fa-solid fa-location-dot"></i></b>
{% if org.location %}
{{ org.location }}
{% else %}
{{ org.location_string }}
{% endif %}
{% if org.description %}
<div class="block content">
<p>{{ org.description | render_markdown }}</p>
</div>
{% endif %}
</div>
{% if org.specializations %}
<div class="block">
<h3 class="title is-5">{% translate 'Spezialisierung' %}</h3>
<div class="content">
<ul>
{% for specialization in org.specializations.all %}
<li>{{ specialization }}</li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
{% if org.parent_org %}
<div class="block">
<h3 class="title is-5">{% translate 'Übergeordnete Organisation' %}</h3>
<p>
<span>
<i class="fa-solid fa-building fa-fw"
aria-label="{% trans 'Tierschutzorganisation' %}"></i>
<a href="{{ org.parent_org.get_absolute_url }}"> {{ org.parent_org }}</a>
</span>
</p>
</div>
{% endif %}
</div>
</div>

View File

@@ -71,19 +71,26 @@
value="{{ rescue_org.pk }}"> value="{{ rescue_org.pk }}">
<input type="hidden" name="action" value="checked"> <input type="hidden" name="action" value="checked">
<button class="" type="submit">{% translate "Organisation geprüft" %}</button> <button class="" type="submit">{% translate "Organisation geprüft" %}</button>
</form> </form>
</div> </div>
<div class="card-footer-item is-danger"> <div class="card-footer-item is-warning">
<form method="post"> <form method="post">
{% csrf_token %} {% csrf_token %}
<input type="hidden" <input type="hidden"
name="rescue_organization_id" name="rescue_organization_id"
value="{{ rescue_org.pk }}"> value="{{ rescue_org.pk }}">
<input type="hidden" name="action" value="exclude"> <input type="hidden" name="action" value="toggle_active_communication">
<button class="" type="submit">{% translate "Von Check exkludieren" %}</button> <button class="" type="submit">
{% if rescue_org.ongoing_communication %}
{% translate "Aktive Kommunikation beendet" %}
{% else %}
{% translate "Aktive Kommunikation" %}
{% endif %}
</button>
</form> </form>
</div> </div>
<div class="card-footer-item is-danger">
<a href="{% url 'rescue-organization-exclude' rescue_organization_id=rescue_org.pk %}">{% translate "Von Check exkludieren" %}</a>
</div>
</div> </div>
</div> </div>

View File

@@ -0,0 +1,20 @@
{% load custom_tags %}
{% load i18n %}
<div class="panel block">
<p class="panel-heading">{% trans "Kontaktdaten" %}</p>
{% if org.has_contact_data %}
{% include "fellchensammlung/partials/partial-in-panel-contact-data.html" %}
{% elif org.parent_org.has_contact_data %}
{% with org=org.parent_org %}
{% include "fellchensammlung/partials/partial-in-panel-contact-data.html" %}
{% endwith %}
{% else %}
<div class="panel-block is-active">
<span class="panel-icon">
<i class="fas fa-x" aria-label="{% translate "E-Mail" %}"></i>
</span>
{% translate 'Keine Kontaktdaten hinterlegt' %}
</div>
{% endif %}
</div>

View File

@@ -3,8 +3,10 @@
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h2 class="card-header-title"><a <h2 class="card-header-title">
href="{{ rescue_organization.get_absolute_url }}"> {{ rescue_organization.name }}</a></h2> <a href="{{ rescue_organization.get_absolute_url }}"> {{ rescue_organization.name }}
</a>
</h2>
</div> </div>
<div class="card-content"> <div class="card-content">
@@ -16,10 +18,10 @@
{{ rescue_organization.location_string }} {{ rescue_organization.location_string }}
{% endif %} {% endif %}
</div> </div>
<div class="block content">
{% if rescue_organization.description_short %} {% if rescue_organization.description_short %}
<div class="block content">
{{ rescue_organization.description_short | render_markdown }} {{ rescue_organization.description_short | render_markdown }}
</div>
{% endif %} {% endif %}
</div> </div>
</div>
</div> </div>

View File

@@ -1,9 +1,10 @@
{% load static %} {% load static %}
{% load i18n %} {% load i18n %}
<div class="grid is-col-min-2"> <div class="grid is-col-min-2">
{% if adoption_notice.num_per_sex.F > 0 %} {% with num_per_sex=adoption_notice.num_per_sex %}
{% if num_per_sex.F > 0 %}
<span class="cell icon-text tag is-medium"> <span class="cell icon-text tag is-medium">
<span class="has-text-weight-bold is-size-4">{{ adoption_notice.num_per_sex.F }} </span> <span class="has-text-weight-bold is-size-4">{{ num_per_sex.F }}</span>
<span class="icon"> <span class="icon">
<img class="icon" src="{% static 'fellchensammlung/img/sexes/Female.png' %}" <img class="icon" src="{% static 'fellchensammlung/img/sexes/Female.png' %}"
alt="{% translate 'weibliche Tiere' %}"> alt="{% translate 'weibliche Tiere' %}">
@@ -11,9 +12,9 @@
</span> </span>
{% endif %} {% endif %}
{% if adoption_notice.num_per_sex.I > 0 %} {% if num_per_sex.I > 0 %}
<span class="cell icon-text tag is-medium"> <span class="cell icon-text tag is-medium">
<span class="has-text-weight-bold is-size-4">{{ adoption_notice.num_per_sex.I }}</span> <span class="has-text-weight-bold is-size-4">{{ num_per_sex.I }}</span>
<span class="icon"> <span class="icon">
<img class="icon" <img class="icon"
@@ -22,18 +23,18 @@
</span> </span>
</span> </span>
{% endif %} {% endif %}
{% if adoption_notice.num_per_sex.M > 0 %} {% if num_per_sex.M > 0 %}
<span class="cell icon-text tag is-medium"> <span class="cell icon-text tag is-medium">
<span class="has-text-weight-bold is-size-4">{{ adoption_notice.num_per_sex.M }}</span> <span class="has-text-weight-bold is-size-4">{{ num_per_sex.M }}</span>
<span class="icon"> <span class="icon">
<img class="icon" src="{% static 'fellchensammlung/img/sexes/Male.png' %}" <img class="icon" src="{% static 'fellchensammlung/img/sexes/Male.png' %}"
alt="{% translate 'männliche Tiere' %}"> alt="{% translate 'männliche Tiere' %}">
</span> </span>
</span> </span>
{% endif %} {% endif %}
{% if adoption_notice.num_per_sex.M_N > 0 %} {% if num_per_sex.M_N > 0 %}
<span class="cell icon-text tag is-medium"> <span class="cell icon-text tag is-medium">
<span class="has-text-weight-bold is-size-4">{{ adoption_notice.num_per_sex.M_N }}</span> <span class="has-text-weight-bold is-size-4">{{ num_per_sex.M_N }}</span>
<span class="icon"> <span class="icon">
<img class="icon" <img class="icon"
src="{% static 'fellchensammlung/img/sexes/Male Neutered.png' %}" src="{% static 'fellchensammlung/img/sexes/Male Neutered.png' %}"
@@ -41,4 +42,5 @@
</span> </span>
</span> </span>
{% endif %} {% endif %}
{% endwith %}
</div> </div>

View File

@@ -23,9 +23,11 @@
</div> </div>
<div class="column"> <div class="column">
{% if dq %} {% if dq %}
<a class="button is-info" href="{% url 'organization-check' %}">{% translate 'Datenergänzung deaktivieren' %}</a> <a class="button is-info"
href="{% url 'organization-check' %}">{% translate 'Datenergänzung deaktivieren' %}</a>
{% else %} {% else %}
<a class="button is-info is-light" href="{% url 'organization-check-dq' %}">{% translate 'Datenergänzung aktivieren' %}</a> <a class="button is-info is-light"
href="{% url 'organization-check-dq' %}">{% translate 'Datenergänzung aktivieren' %}</a>
{% endif %} {% endif %}
</div> </div>
</div> </div>
@@ -36,7 +38,7 @@
<div class="grid is-col-min-15"> <div class="grid is-col-min-15">
{% for rescue_org in rescue_orgs_to_check %} {% for rescue_org in rescue_orgs_to_check %}
<div class="cell"> <div class="cell">
{% include "fellchensammlung/partials/partial-check-rescue-org.html" %} {% include "fellchensammlung/partials/rescue_orgs/partial-check-rescue-org.html" %}
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
@@ -48,7 +50,7 @@
<div class="grid is-col-min-15"> <div class="grid is-col-min-15">
{% for rescue_org in rescue_orgs_with_ongoing_communication %} {% for rescue_org in rescue_orgs_with_ongoing_communication %}
<div class="cell"> <div class="cell">
{% include "fellchensammlung/partials/partial-check-rescue-org.html" %} {% include "fellchensammlung/partials/rescue_orgs/partial-check-rescue-org.html" %}
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
@@ -60,9 +62,10 @@
<div class="grid is-col-min-15"> <div class="grid is-col-min-15">
{% for rescue_org in rescue_orgs_last_checked %} {% for rescue_org in rescue_orgs_last_checked %}
<div class="cell"> <div class="cell">
{% include "fellchensammlung/partials/partial-check-rescue-org.html" %} {% include "fellchensammlung/partials/rescue_orgs/partial-check-rescue-org.html" %}
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
{% include "fellchensammlung/partials/modal-shortcuts.html" %}
{% endblock %} {% endblock %}

View File

@@ -65,7 +65,7 @@
{% endif %} {% endif %}
</div> </div>
{% if not subscribed_search %} {% if not subscribed_search %}
<div class="block">{% translate 'Wenn du die Suche abbonierst, wirst du für neue Vermittlungen, die den Kriterien entsprechen, benachrichtigt.' %}</div> <div class="block">{% translate 'Wenn du die Suche abonnierst, wirst du für neue Vermittlungen, die den Kriterien entsprechen, benachrichtigt.' %}</div>
{% endif %} {% endif %}
{% else %} {% else %}
<button class="button is-primary is-fullwidth" type="submit" value="search" name="search"> <button class="button is-primary is-fullwidth" type="submit" value="search" name="search">

View File

@@ -0,0 +1,43 @@
{% extends "mfa/recovery_codes/base.html" %}
{% load i18n %}
{% load allauth %}
{% block content %}
{% element h1 %}
{% translate "Recovery Codes" %}
{% endelement %}
{% element p %}
{% blocktranslate count unused_count=unused_codes|length %}There is {{ unused_count }} out of {{ total_count }}
recovery codes available.{% plural %}There are {{ unused_count }} out of {{ total_count }} recovery codes
available.{% endblocktranslate %}
{% endelement %}
<div class="block">
{% element field id="recovery_codes" type="textarea" disabled=True rows=unused_codes|length readonly=True %}
{% slot label %}
{% translate "Unused codes" %}
{% endslot %}
{% comment %} djlint:off {% endcomment %}
{% slot value %}{% for code in unused_codes %}{% if forloop.counter0 %}
{% endif %}{{ code }}{% endfor %}{% endslot %}
{% comment %} djlint:on {% endcomment %}
{% endelement %}
</div>
<div class="block">
<div class="field is-grouped is-grouped-multiline">
{% if unused_codes %}
{% url 'mfa_download_recovery_codes' as download_url %}
<div class="control">
{% element button href=download_url %}
{% translate "Download codes" %}
{% endelement %}
</div>
{% endif %}
{% url 'mfa_generate_recovery_codes' as generate_url %}
<div class="control">
{% element button href=generate_url %}
{% translate "Generate new codes" %}
{% endelement %}
</div>
</div>
</div>
{% endblock content %}

View File

@@ -0,0 +1,78 @@
{% extends "mfa/webauthn/base.html" %}
{% load i18n %}
{% load static %}
{% load allauth %}
{% load humanize %}
{% block content %}
{% element h1 %}
{% trans "Security Keys" %}
{% endelement %}
{% if authenticators|length == 0 %}
{% element p %}
{% blocktranslate %}No security keys have been added.{% endblocktranslate %}
{% endelement %}
{% else %}
<article class="panel">
<p class="panel-heading">{% trans "Security Keys" %}</p>
{% for authenticator in authenticators %}
<div class="panel-block">
<div class="level" style="width: 100%;">
<div class="level-left">
<div class="level-item">
{% if authenticator.wrap.is_passwordless is True %}
{% element badge tags="mfa,key,primary" %}
{% translate "Passkey" %}
{% endelement %}
{% elif authenticator.wrap.is_passwordless is False %}
{% element badge tags="mfa,key,secondary" %}
{% translate "Security key" %}
{% endelement %}
{% else %}
{% element badge title=_("This key does not indicate whether it is a passkey.") tags="mfa,key,warning" %}
{% translate "Unspecified" %}
{% endelement %}
{% endif %}
</div>
<div class="level-item">
<strong>
{{ authenticator }}
</strong>
</div>
<div class="level-item">
{% blocktranslate with created_at=authenticator.created_at|date:"SHORT_DATE_FORMAT" %}
Added
on {{ created_at }}{% endblocktranslate %}.
</div>
<div class="level-item">
{% if authenticator.last_used_at %}
{% blocktranslate with last_used=authenticator.last_used_at|naturaltime %}Last used
{{ last_used }}{% endblocktranslate %}
{% else %}
Not used.
{% endif %}
</div>
</div>
<div class="level-right">
<div class="level-item">
{% url 'mfa_edit_webauthn' pk=authenticator.pk as edit_url %}
{% element button tags="mfa,authenticator,edit,tool" href=edit_url %}
{% translate "Edit" %}
{% endelement %}
</div>
<div class="level-item">
{% url 'mfa_remove_webauthn' pk=authenticator.pk as remove_url %}
{% element button tags="mfa,authenticator,danger,delete,tool" href=remove_url %}
{% translate "Remove" %}
{% endelement %}
</div>
</div>
</div>
</div>
{% endfor %}
</article>
{% endif %}
{% url 'mfa_add_webauthn' as add_url %}
{% element button href=add_url %}
{% translate "Add" %}
{% endelement %}
{% endblock %}

View File

@@ -49,7 +49,7 @@ def render_markdown(value):
@register.simple_tag @register.simple_tag
def get_oxitraffic_script_if_enabled(): def get_oxitraffic_script_if_enabled():
if settings.OXITRAFFIC_ENABLED: if settings.OXITRAFFIC_ENABLED:
return mark_safe(f'<script type="module" src="https://{settings.OXITRAFFIC_BASE_URL}/count.js"></script>') return mark_safe(f'<script type="module" src="{settings.OXITRAFFIC_BASE_URL}/count.js"></script>')
else: else:
return "" return ""

View File

@@ -1,6 +1,8 @@
import logging import logging
from random import randint from random import randint
from fellchensammlung.tools.model_helpers import AdoptionNoticeStatusChoices
from notfellchen import settings from notfellchen import settings
from django.utils import timezone from django.utils import timezone
from datetime import timedelta from datetime import timedelta
@@ -10,7 +12,7 @@ from django.template.loader import render_to_string
from django.core import mail from django.core import mail
from django.utils.html import strip_tags from django.utils.html import strip_tags
from fellchensammlung.models import AdoptionNotice, Location, RescueOrganization, AdoptionNoticeStatus, Log, \ from fellchensammlung.models import AdoptionNotice, Location, RescueOrganization, Log, \
Notification, NotificationTypeChoices Notification, NotificationTypeChoices
from fellchensammlung.tools.misc import is_404 from fellchensammlung.tools.misc import is_404
@@ -86,7 +88,8 @@ def deactivate_404_adoption_notices():
for adoption_notice in get_active_adoption_notices(): for adoption_notice in get_active_adoption_notices():
if adoption_notice.further_information and adoption_notice.further_information != "": if adoption_notice.further_information and adoption_notice.further_information != "":
if is_404(adoption_notice.further_information): if is_404(adoption_notice.further_information):
adoption_notice.set_closed() adoption_notice.adoption_notice_status = AdoptionNoticeStatusChoices.Closed.LINK_TO_MORE_INFO_NOT_REACHABLE
adoption_notice.save()
logging_msg = f"Automatically set Adoption Notice {adoption_notice.id} closed as link to more information returened 404" logging_msg = f"Automatically set Adoption Notice {adoption_notice.id} closed as link to more information returened 404"
logging.info(logging_msg) logging.info(logging_msg)
Log.objects.create(action="automated", text=logging_msg) Log.objects.create(action="automated", text=logging_msg)

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