Compare commits

..

No commits in common. "6702211c05eb8505e84e2bff5a0a3c5e86f0b31a" and "fd3478600f0243ba50417e6e19da14eba17e5c44" have entirely different histories.

20 changed files with 101 additions and 176 deletions

View File

@ -4,5 +4,9 @@ Administration
:maxdepth: 2 :maxdepth: 2
:caption: Contents: :caption: Contents:
GDPR.rst create_user.rst
lending.rst
returning.rst
opening_hours.rst
add_items.rst
monitoring.rst monitoring.rst

View File

@ -1,7 +1,7 @@
Monitoring Monitoring
========== ==========
Notfellchen should, like every other software, be easy to monitor. Therefore a basic metrics are exposed to `https://notfellchen.org/metrics`. ILMO should, like every other software, be easy to monitor. Therefore a basic metrics are exposed to `https://notfellchen.org/metrics`.
The data is encoded in JSON format and is therefore suitable to bea read by humans and it is easy to use it as data source for further processing. The data is encoded in JSON format and is therefore suitable to bea read by humans and it is easy to use it as data source for further processing.

View File

@ -0,0 +1,10 @@
Opening hours
=============
The opening hours can be changed by selecting the page :guilabel:`Opening hours` in the navigation menu.
You can not change an entry, simply delete it and create a new one.
.. note::
It is advised to fill empty time cells with a "-".

8
docs/admin/returning.rst Normal file
View File

@ -0,0 +1,8 @@
Returning
=========
To return an item either visit the page :guilabel:`All loans` and search
for the loan there or you search for the item via :guilabel:`Search`.
If you found the loan, you can simply click on the button :guilabel:`Return` and
you are finished.

View File

@ -4,16 +4,16 @@
Deployment Deployment
********** **********
There are different ways to deploy Notfellchen. We support an ansible+docker based deployment and manual installation. There are different ways to deploy ILMO. We support an ansible+docker based deployment and manual installation.
Ansible deployment Ansible deployment
================== ==================
Notfellchen can be deployed with the `notfellchen-ansible-role <https://github.com/moan0s/ansible-role-notfellchen>`_ that is based on the ILMO can be deployed with the `ilmo-ansible-role <https://github.com/moan0s/ansible-role-ilmo>`_ that is based on the
official Notfellchen docker image. This role will only install notfellchen itself. If you want a complete setup that includes a official ILMO docker image. This role will only install ilmo itself. If you want a complete setup that includes a
database and a webserver with minimal configuration you can use the database and a webserver with minimal configuration you can use the
`mash-playbook <https://github.com/mother-of-all-self-hosting/mash-playbook>`_ by following `it's documentation `mash-playbook <https://github.com/mother-of-all-self-hosting/mash-playbook>`_ by following `it's documentation
on Notfellchen <https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/notfellchen.md>`_. on ILMO <https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/ilmo.md>`_.
@ -21,10 +21,10 @@ Manual Deployment
================= =================
This guide describes the installation of a installation of Notfellchen from source. It is inspired by this great guide from This guide describes the installation of a installation of ILMO from source. It is inspired by this great guide from
pretix_. pretix_.
.. warning:: Even though this guide tries to make it as straightforward to run Notfellchen, it still requires some Linux experience to .. warning:: Even though this guide tries to make it as straightforward to run ILMO, it still requires some Linux experience to
get it right. If you're not feeling comfortable managing a Linux server, check out a managed service_. get it right. If you're not feeling comfortable managing a Linux server, check out a managed service_.
This guide is tested on **Ubuntu20.04** but it should work very similar on other modern systemd based distributions. This guide is tested on **Ubuntu20.04** but it should work very similar on other modern systemd based distributions.
@ -39,18 +39,18 @@ installation guides):
* A HTTP reverse proxy, e.g. `nginx`_ or Traefik to allow HTTPS connections * A HTTP reverse proxy, e.g. `nginx`_ or Traefik to allow HTTPS connections
* A `PostgreSQL`_ database server * A `PostgreSQL`_ database server
Also recommended is, that you use a firewall, although this is not a Notfellchen-specific recommendation. If you're new to Also recommended is, that you use a firewall, although this is not a ILMO-specific recommendation. If you're new to
Linux and firewalls, it is recommended that you start with `ufw`_. Linux and firewalls, it is recommended that you start with `ufw`_.
.. note:: Please, do not run Notfellchen without HTTPS encryption. You'll handle user data and thanks to `Let's Encrypt`_ .. note:: Please, do not run ILMO without HTTPS encryption. You'll handle user data and thanks to `Let's Encrypt`_
SSL certificates can be obtained for free these days. SSL certificates can be obtained for free these days.
Unix user Unix user
--------- ---------
As we do not want to run notfellchen as root, we first create a new unprivileged user:: As we do not want to run ilmo as root, we first create a new unprivileged user::
# adduser notfellchen --disabled-password --home /var/notfellchen # adduser ilmo --disabled-password --home /var/ilmo
In this guide, all code lines prepended with a ``#`` symbol are commands that you need to execute on your server as In this guide, all code lines prepended with a ``#`` symbol are commands that you need to execute on your server as
``root`` user (e.g. using ``sudo``); all lines prepended with a ``$`` symbol should be run by the unprivileged user. ``root`` user (e.g. using ``sudo``); all lines prepended with a ``$`` symbol should be run by the unprivileged user.
@ -66,16 +66,16 @@ best compatibility. You can check this with the following command::
For PostgreSQL database creation, we would do:: For PostgreSQL database creation, we would do::
# sudo -u postgres createuser notfellchen # sudo -u postgres createuser ilmo
# sudo -u postgres createdb -O notfellchen notfellchen # sudo -u postgres createdb -O ilmo ilmo
# su notfellchen # su ilmo
$ psql $ psql
> ALTER USER notfellchen PASSWORD 'strong_password'; > ALTER USER ilmo PASSWORD 'strong_password';
Package dependencies Package dependencies
-------------------- --------------------
To build and run notfellchen, you will need the following debian packages:: To build and run ilmo, you will need the following debian packages::
# apt-get install git build-essential python-dev python3-venv python3 python3-pip \ # apt-get install git build-essential python-dev python3-venv python3 python3-pip \
python3-dev python3-dev
@ -83,32 +83,32 @@ To build and run notfellchen, you will need the following debian packages::
Config file Config file
----------- -----------
We now create a config directory and config file for notfellchen:: We now create a config directory and config file for ilmo::
# mkdir /etc/notfellchen # mkdir /etc/ilmo
# touch /etc/notfellchen/notfellchen.cfg # touch /etc/ilmo/ilmo.cfg
# chown -R notfellchen:notfellchen /etc/notfellchen/ # chown -R ilmo:ilmo /etc/ilmo/
# chmod 0600 /etc/notfellchen/notfellchen.cfg # chmod 0600 /etc/ilmo/ilmo.cfg
Fill the configuration file ``/etc/notfellchen/notfellchen.cfg`` with the following content (adjusted to your environment):: Fill the configuration file ``/etc/ilmo/ilmo.cfg`` with the following content (adjusted to your environment)::
[notfellchen] [ilmo]
instance_name=My library instance_name=My library
url=https://notfellchen.example.com url=https://ilmo.example.com
[database] [database]
backend=postgresql backend=postgresql
name=notfellchen name=ilmo
user=notfellchen user=ilmo
[locations] [locations]
static=/var/notfellchen/static static=/var/ilmo/static
[mail] [mail]
; See config file documentation for more options ; See config file documentation for more options
; from=notfellchen@example.com ; from=ilmo@example.com
; host=127.0.0.1 ; host=127.0.0.1
; user=notfellchen ; user=ilmo
; password=foobar ; password=foobar
; port=587 ; port=587
@ -121,21 +121,21 @@ Fill the configuration file ``/etc/notfellchen/notfellchen.cfg`` with the follow
;Scope= ;Scope=
;Policy= ;Policy=
Install notfellchen as package Install ilmo as package
------------------------ ------------------------
Now we will install notfellchen itself. The following steps are to be executed as the ``notfellchen`` user. Before we Now we will install ilmo itself. The following steps are to be executed as the ``ilmo`` user. Before we
actually install notfellchen, we will create a virtual environment to isolate the python packages from your global actually install ilmo, we will create a virtual environment to isolate the python packages from your global
python installation:: python installation::
$ python3 -m venv /var/notfellchen/venv $ python3 -m venv /var/ilmo/venv
$ source /var/notfellchen/venv/bin/activate $ source /var/ilmo/venv/bin/activate
(venv)$ pip3 install -U pip setuptools wheel (venv)$ pip3 install -U pip setuptools wheel
We now clone and install notfellchen, its direct dependencies and gunicorn:: We now clone and install ilmo, its direct dependencies and gunicorn::
(venv)$ git clone https://github.com/moan0s/Notfellchen2 (venv)$ git clone https://github.com/moan0s/ILMO2
(venv)$ cd Notfellchen2/src/ (venv)$ cd ILMO2/src/
(venv)$ pip3 install -r requirements.txt (venv)$ pip3 install -r requirements.txt
(venv)$ pip3 install -e . (venv)$ pip3 install -e .
@ -148,26 +148,26 @@ Finally, we compile static files and create the database structure::
(venv)$ django-admin compilemessages --ignore venv (venv)$ django-admin compilemessages --ignore venv
Start notfellchen as a service Start ilmo as a service
------------------------- -------------------------
You should start notfellchen using systemd to automatically start it after a reboot. Create a file You should start ilmo using systemd to automatically start it after a reboot. Create a file
named ``/etc/systemd/system/notfellchen-web.service`` with the following content:: named ``/etc/systemd/system/ilmo-web.service`` with the following content::
[Unit] [Unit]
Description=notfellchen web service Description=ilmo web service
After=network.target After=network.target
[Service] [Service]
User=notfellchen User=ilmo
Group=notfellchen Group=ilmo
Environment="VIRTUAL_ENV=/var/notfellchen/venv" Environment="VIRTUAL_ENV=/var/ilmo/venv"
Environment="PATH=/var/notfellchen/venv/bin:/usr/local/bin:/usr/bin:/bin" Environment="PATH=/var/ilmo/venv/bin:/usr/local/bin:/usr/bin:/bin"
ExecStart=/var/notfellchen/venv/bin/gunicorn notfellchen.wsgi \ ExecStart=/var/ilmo/venv/bin/gunicorn ilmo.wsgi \
--name notfellchen --workers 5 \ --name ilmo --workers 5 \
--max-requests 1200 --max-requests-jitter 50 \ --max-requests 1200 --max-requests-jitter 50 \
--log-level=info --bind=127.0.0.1:8345 --log-level=info --bind=127.0.0.1:8345
WorkingDirectory=/var/notfellchen WorkingDirectory=/var/ilmo
Restart=on-failure Restart=on-failure
[Install] [Install]
@ -176,14 +176,14 @@ named ``/etc/systemd/system/notfellchen-web.service`` with the following content
You can now run the following commands to enable and start the services:: You can now run the following commands to enable and start the services::
# systemctl daemon-reload # systemctl daemon-reload
# systemctl enable notfellchen-web # systemctl enable ilmo-web
# systemctl start notfellchen-web # systemctl start ilmo-web
SSL SSL
--- ---
The following snippet is an example on how to configure a nginx proxy for notfellchen:: The following snippet is an example on how to configure a nginx proxy for ilmo::
server { server {
listen 80; listen 80;
@ -196,8 +196,8 @@ The following snippet is an example on how to configure a nginx proxy for notfel
# #
listen 443 ssl; listen 443 ssl;
listen [::]:443 ssl; listen [::]:443 ssl;
ssl_certificate /etc/letsencrypt/live/notfellchen.example.com/cert.pem; ssl_certificate /etc/letsencrypt/live/ilmo.example.com/cert.pem;
ssl_certificate_key /etc/letsencrypt/live/notfellchen.example.com/privkey.pem; ssl_certificate_key /etc/letsencrypt/live/ilmo.example.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3; ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5; ssl_ciphers HIGH:!aNULL:!MD5;
@ -208,7 +208,7 @@ The following snippet is an example on how to configure a nginx proxy for notfel
add_header Referrer-Policy same-origin; add_header Referrer-Policy same-origin;
add_header X-Content-Type-Options nosniff; add_header X-Content-Type-Options nosniff;
server_name notfellchen.example.com; server_name ilmo.example.com;
location / { location / {
proxy_pass http://localhost:8345; proxy_pass http://localhost:8345;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -217,7 +217,7 @@ The following snippet is an example on how to configure a nginx proxy for notfel
} }
location /static/ { location /static/ {
alias /var/notfellchen/static/; alias /var/ilmo/static/;
access_log off; access_log off;
expires 365d; expires 365d;
add_header Cache-Control "public"; add_header Cache-Control "public";
@ -230,22 +230,22 @@ We recommend reading about setting `strong encryption settings`_ for your web se
Next steps Next steps
---------- ----------
Yay, you are done! You should now be able to reach notfellchen at https://notfellchen.example.com/ Yay, you are done! You should now be able to reach ilmo at https://ilmo.example.com/
Updates Updates
------- -------
.. warning:: While we try hard not to break things, **please perform a backup before every upgrade**. .. warning:: While we try hard not to break things, **please perform a backup before every upgrade**.
To upgrade to a new notfellchen release, pull the latest code changes and run the following commands:: To upgrade to a new ilmo release, pull the latest code changes and run the following commands::
$ source /var/notfellchen/venv/bin/activate $ source /var/ilmo/venv/bin/activate
(venv)$ git pull (venv)$ git pull
(venv)$ pg_dump notfellchen > notfellchen.psql (venv)$ pg_dump ilmo > ilmo.psql
(venv)$ python manage.py migrate (venv)$ python manage.py migrate
(venv)$ django-admin compilemessages --ignore venv (venv)$ django-admin compilemessages --ignore venv
# systemctl restart notfellchen-web # systemctl restart ilmo-web
.. _Postfix: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-16-04 .. _Postfix: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-16-04

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

View File

@ -1,18 +1,9 @@
Benachrichtigungen Benachrichtigungen
================== ==================
Jede Vermittlung kann abonniert werden. Dafür klickst du auf die Glocke neben dem Titel der Vermittlung.
.. image:: abonnieren.png
Auf der Website
+++++++++++++++
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 Addresse an.
Wir senden dir Benachrichtigungen an diese E-Mail. Du kannst das in deinen Profileinstellungen anpassen.
Benachrichtigungen senden wir per Mail - du kannst das jederzeit in den Einstellungen deaktivieren.

View File

@ -7,4 +7,5 @@ Users guide
registrierung.rst registrierung.rst
benachrichtigungen.rst benachrichtigungen.rst
vermittlungen.rst login.rst
email.rst

View File

@ -1,10 +1,5 @@
Registrierung Registration
================================ ================================
Du kannst dich jederzeit selbst registrieren. Das geht unter https://notfellchen.org/accounts/register/ To register you have to visit the library. An librarian will then set up an account for you.
You will need to provide an valid E-Mail Address and a password.
Ein Account ermöglicht es dir
* Kommentare zu hinterlassen
* Vermittlungen hinzuzufügen
* Vermittlungen zu abonnieren

View File

@ -9,9 +9,10 @@ Nach 3 Wochen ohne Prüfung werden Anzeigen automatisch von der Seite entfernt u
Darüber hinaus werden einmal täglich die verlinkten Seiten automatisiert geprüft. Wenn eine Vermittlungs-Seite bei einem Tierheim oder einer Pflegestelle entfernt wurde, wird die Anzeige ebenfalls deaktiviert. Darüber hinaus werden einmal täglich die verlinkten Seiten automatisiert geprüft. Wenn eine Vermittlungs-Seite bei einem Tierheim oder einer Pflegestelle entfernt wurde, wird die Anzeige ebenfalls deaktiviert.
Vermittlungen können von allen Menschen, auch ohne Account gemeldet werden. Grund dafür kann sein, dass Informationen veraltet sind oder ein Verdacht von Tierwohlgefärdung. Gemeldete Vermittlungen werden vom Moderationsteam geprüft und ggf. entfernt. Vermittlungen können von allen Menschen, auch ohne Account gemeldet werden. Grund dafür kann sein, dass Informationen veraltet sind oder Verdacht von Tierwohlgefärdung. Gemeldete Vermittlungen werden vom Moderationsteam geprüft und ggf. entfernt.
Die Kommentarfunktion von Vermittlungen ermöglicht es angemeldeten Nutzer*innen zusätzliche Informationen hinzuzufügen oder Fragen zu stellen. Die Kommentarfunktion von Vermittlungen ermöglicht es angemeldeten Nutzer*innen zusätzliche Informationen hinzuzufügen oder Fragen zu stellen.
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.

View File

@ -1,21 +0,0 @@
# Generated by Django 5.1.1 on 2024-10-19 18:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fellchensammlung', '0009_log'),
]
operations = [
migrations.CreateModel(
name='Timestamp',
fields=[
('key', models.CharField(max_length=255, primary_key=True, serialize=False, verbose_name='Schlüssel')),
('timestamp', models.DateTimeField(auto_now_add=True, verbose_name='Zeitstempel')),
('data', models.CharField(blank=True, max_length=2000, null=True)),
],
),
]

View File

@ -287,12 +287,6 @@ class AdoptionNotice(models.Model):
return False return False
return self.adoptionnoticestatus.is_active return self.adoptionnoticestatus.is_active
@property
def is_to_be_checked(self, include_active=False):
if not hasattr(self, 'adoptionnoticestatus'):
return False
return self.adoptionnoticestatus.is_to_be_checked or (include_active and self.adoptionnoticestatus.is_active)
def set_checked(self): def set_checked(self):
self.last_checked = datetime.now() self.last_checked = datetime.now()
self.save() self.save()
@ -359,10 +353,6 @@ class AdoptionNoticeStatus(models.Model):
def is_active(self): def is_active(self):
return self.major_status == self.ACTIVE return self.major_status == self.ACTIVE
@property
def is_to_be_checked(self):
return self.major_status == self.DISABLED and self.minor_status == "unchecked"
@staticmethod @staticmethod
def get_minor_choices(major_status): def get_minor_choices(major_status):
return AdoptionNoticeStatus.MINOR_STATUS_CHOICES[major_status] return AdoptionNoticeStatus.MINOR_STATUS_CHOICES[major_status]
@ -665,16 +655,4 @@ class Log(models.Model):
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True)
def __str__(self): def __str__(self):
return f"[{self.action}] - {self.user} - {self.created_at.strftime('%H:%M:%S %d-%m-%Y ')}" return f"[{self.action}] - {self.user} - {self.created_at.strftime('%H:%M:%S %d-%m-%Y ')}"
class Timestamp(models.Model):
"""
Class to store timestamps based on keys
"""
key = models.CharField(max_length=255, verbose_name=_("Schlüssel"), primary_key=True)
timestamp = models.DateTimeField(auto_now_add=True, verbose_name=_("Zeitstempel"))
data = models.CharField(max_length=2000, blank=True, null=True)
def ___str__(self):
return f"[{self.key}] - {self.timestamp.strftime('%H:%M:%S %d-%m-%Y ')} - {self.data}"

View File

@ -1,38 +1,24 @@
from datetime import datetime
from notfellchen.celery import app as celery_app from notfellchen.celery import app as celery_app
from .tools.admin import clean_locations, deactivate_unchecked_adoption_notices from .tools.admin import clean_locations, deactivate_unchecked_adoption_notices
from .tools.misc import healthcheck_ok from .tools.misc import healthcheck_ok
from .models import Location, AdoptionNotice, Timestamp from .models import Location, AdoptionNotice
def set_timestamp(key: str):
try:
ts = Timestamp.objects.get(key=key)
ts.timestamp = datetime.now()
except Timestamp.DoesNotExist:
Timestamp.objects.create(key=key, timestamp=datetime.now())
@celery_app.task(name="admin.clean_locations") @celery_app.task(name="admin.clean_locations")
def task_clean_locations(): def task_clean_locations():
clean_locations() clean_locations()
set_timestamp("task_clean_locations")
@celery_app.task(name="admin.deactivate_unchecked") @celery_app.task(name="admin.deactivate_unchecked")
def task_deactivate_unchecked(): def task_deactivate_unchecked():
deactivate_unchecked_adoption_notices() deactivate_unchecked_adoption_notices()
set_timestamp("task_deactivate_unchecked")
@celery_app.task(name="commit.add_location") @celery_app.task(name="commit.add_location")
def add_adoption_notice_location(pk): def add_adoption_notice_location(pk):
instance = AdoptionNotice.objects.get(pk=pk) instance = AdoptionNotice.objects.get(pk=pk)
Location.add_location_to_object(instance) Location.add_location_to_object(instance)
set_timestamp("add_adoption_notice_location")
@celery_app.task(name="tools.healthcheck") @celery_app.task(name="tools.healthcheck")
def task_healthcheck(): def task_healthcheck():
healthcheck_ok() healthcheck_ok()
set_timestamp("task_healthcheck")

View File

@ -2,7 +2,7 @@
{% load custom_tags %} {% load custom_tags %}
{% load i18n %} {% load i18n %}
{% block title %}<title>{{ animal.name }}</title>{% endblock %} {% block title %}<title>{{ animal.name }}</title> %}
{% block content %} {% block content %}
{% include "fellchensammlung/details/detail-animal-partial.html" %} {% include "fellchensammlung/details/detail-animal-partial.html" %}

View File

@ -2,7 +2,7 @@
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block title %}<title>{% translate "Vermittlung hinzufügen" %}</title>{% endblock %} {% block title %}<title>{% translate "Vermittlung hinzufügen" %}</title> %}{% endblock %}
{% block content %} {% block content %}
<h1>{% translate "Vermitteln" %}</h1> <h1>{% translate "Vermitteln" %}</h1>

View File

@ -24,28 +24,6 @@
<p>{% translate "Texte scheinen vollständig" %}</p> <p>{% translate "Texte scheinen vollständig" %}</p>
{% endif %} {% endif %}
<h2>{% trans "Zeitstempel" %}</h2>
{% if timestamps|length > 0 %}
<p>
<table>
<tr>
<th>{% translate "Key" %}</th>
<th>{% translate "Zeitstempel" %}</th>
<th>{% translate "Daten" %}</th>
</tr>
{% for timestamp in timestamps %}
<tr>
<td>{{ timestamp.key }}</td>
<td>{{ timestamp.timestamp }}</td>
<td>{{ timestamp.data }}</td>
</tr>
{% endfor %}
</table>
</p>
{% else %}
<p>{% translate "Keine Zeitstempel geloggt." %}</p>
{% endif %}
<h2>{% translate "Nicht-lokalisierte Vermittlungen" %}</h2> <h2>{% translate "Nicht-lokalisierte Vermittlungen" %}</h2>
{% if number_not_geocoded_adoption_notices > 0 %} {% if number_not_geocoded_adoption_notices > 0 %}
<details> <details>

View File

@ -1,7 +1,7 @@
{% extends "fellchensammlung/base_generic.html" %} {% extends "fellchensammlung/base_generic.html" %}
{% load i18n %} {% load i18n %}
{% block title %}<title>{% translate "Suche" %}</title>{% endblock %} {% block title %}<title>{% translate "Suche" %}</title> %}
{% block content %} {% block content %}
<form class="form-search card" method="post"> <form class="form-search card" method="post">

View File

@ -31,6 +31,6 @@ def age_as_hr_string(age: datetime.timedelta) -> str:
def healthcheck_ok(): def healthcheck_ok():
try: try:
requests.get(settings.HEALTHCHECKS_URL, timeout=10) requests.get(settings.HEALTHCHECK_URL, timeout=10)
except requests.RequestException as e: except requests.RequestException as e:
logging.error("Ping to healthcheck-server failed: %s" % e) logging.error("Ping to healthcheck-server failed: %s" % e)

View File

@ -14,7 +14,7 @@ from notfellchen import settings
from fellchensammlung import logger from fellchensammlung import logger
from .models import AdoptionNotice, Text, Animal, Rule, Image, Report, ModerationAction, \ from .models import AdoptionNotice, Text, Animal, Rule, Image, Report, ModerationAction, \
User, Location, AdoptionNoticeStatus, Subscriptions, CommentNotification, BaseNotification, RescueOrganization, \ User, Location, AdoptionNoticeStatus, Subscriptions, CommentNotification, BaseNotification, RescueOrganization, \
Species, Log, Timestamp Species, Log
from .forms import AdoptionNoticeForm, AdoptionNoticeFormWithDateWidget, ImageForm, ReportAdoptionNoticeForm, \ from .forms import AdoptionNoticeForm, AdoptionNoticeFormWithDateWidget, ImageForm, ReportAdoptionNoticeForm, \
CommentForm, ReportCommentForm, AnimalForm, \ CommentForm, ReportCommentForm, AnimalForm, \
AdoptionNoticeSearchForm, AnimalFormWithDateWidget, AdoptionNoticeFormWithDateWidgetAutoAnimal AdoptionNoticeSearchForm, AnimalFormWithDateWidget, AdoptionNoticeFormWithDateWidgetAutoAnimal
@ -80,8 +80,6 @@ def adoption_notice_detail(request, adoption_notice_id):
is_subscribed = True is_subscribed = True
except Subscriptions.DoesNotExist: except Subscriptions.DoesNotExist:
is_subscribed = False is_subscribed = False
else:
is_subscribed = False
has_edit_permission = user_is_owner_or_trust_level(request.user, adoption_notice) has_edit_permission = user_is_owner_or_trust_level(request.user, adoption_notice)
if request.method == 'POST': if request.method == 'POST':
action = request.POST.get("action") action = request.POST.get("action")
@ -470,7 +468,7 @@ def updatequeue(request):
last_checked_adoption_list = AdoptionNotice.objects.order_by("last_checked") last_checked_adoption_list = AdoptionNotice.objects.order_by("last_checked")
else: else:
last_checked_adoption_list = AdoptionNotice.objects.filter(owner=request.user).order_by("last_checked") last_checked_adoption_list = AdoptionNotice.objects.filter(owner=request.user).order_by("last_checked")
adoption_notices = [adoption for adoption in last_checked_adoption_list if adoption.is_active or adoption.is_to_be_checked] adoption_notices = [adoption for adoption in last_checked_adoption_list if adoption.is_active]
context = {"adoption_notices": adoption_notices} context = {"adoption_notices": adoption_notices}
return render(request, 'fellchensammlung/updatequeue.html', context=context) return render(request, 'fellchensammlung/updatequeue.html', context=context)
@ -522,9 +520,6 @@ def instance_health_check(request):
except Text.DoesNotExist: except Text.DoesNotExist:
missing_texts.append((text_code, language)) missing_texts.append((text_code, language))
# Timestamps
timestamps = Timestamp.objects.all()
context = { context = {
"number_of_adoption_notices": number_of_adoption_notices, "number_of_adoption_notices": number_of_adoption_notices,
"number_not_geocoded_adoption_notices": number_not_geocoded_adoption_notices, "number_not_geocoded_adoption_notices": number_not_geocoded_adoption_notices,
@ -534,8 +529,7 @@ def instance_health_check(request):
"none_geocoded_rescue_orgs": none_geocoded_rescue_orgs, "none_geocoded_rescue_orgs": none_geocoded_rescue_orgs,
"missing_texts": missing_texts, "missing_texts": missing_texts,
"number_unchecked_ans": number_unchecked_ans, "number_unchecked_ans": number_unchecked_ans,
"unchecked_ans": unchecked_ans, "unchecked_ans": unchecked_ans
"timestamps": timestamps
} }
return render(request, 'fellchensammlung/instance-health-check.html', context=context) return render(request, 'fellchensammlung/instance-health-check.html', context=context)

View File

@ -25,5 +25,5 @@ app.conf.beat_schedule = {
if settings.HEALTHCHECKS_URL is not None and settings.HEALTHCHECKS_URL != "": if settings.HEALTHCHECKS_URL is not None and settings.HEALTHCHECKS_URL != "":
# If a healthcheck is configured, this will send an hourly ping to the healthchecks server # If a healthcheck is configured, this will send an hourly ping to the healthchecks server
app.conf.beat_schedule['hourly-healthcheck'] = {'task': 'tools.healthcheck', app.conf.beat_schedule['hourly-healthcheck'] = {'task': 'tools.healthcheck',
'schedule': crontab(minute=43), 'schedule': crontab(minute=32),
} }