Notfellchen/src/fellchensammlung/views.py

545 lines
23 KiB
Python
Raw Normal View History

2024-05-30 07:26:04 +00:00
import logging
2024-06-06 21:16:57 +00:00
from django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts import render, redirect
from django.urls import reverse
2024-04-12 21:37:03 +00:00
from django.contrib.auth.decorators import login_required
2024-04-14 13:45:57 +00:00
from django.utils import translation
2024-05-30 12:37:15 +00:00
from django.core.exceptions import PermissionDenied
from django.contrib.auth.decorators import user_passes_test
2024-05-30 12:37:15 +00:00
from .mail import mail_admins_new_report
2024-04-12 21:37:03 +00:00
from notfellchen import settings
2024-03-17 10:26:32 +00:00
2024-05-30 07:26:04 +00:00
from fellchensammlung import logger
from .models import AdoptionNotice, Text, Animal, Rule, Image, Report, ModerationAction, \
2024-10-05 09:22:10 +00:00
User, Location, AdoptionNoticeStatus, Subscriptions, CommentNotification, BaseNotification, RescueOrganization, \
Species, Log, Timestamp
from .forms import AdoptionNoticeForm, AdoptionNoticeFormWithDateWidget, ImageForm, ReportAdoptionNoticeForm, \
CommentForm, ReportCommentForm, AnimalForm, \
AdoptionNoticeSearchForm, AnimalFormWithDateWidget, AdoptionNoticeFormWithDateWidgetAutoAnimal
2024-05-31 07:58:03 +00:00
from .models import Language, Announcement
from .tools.geo import GeoAPI
2024-06-06 21:16:57 +00:00
from .tools.metrics import gather_metrics_data
from .tools.admin import clean_locations, get_unchecked_adoption_notices, deactivate_unchecked_adoption_notices
2024-10-10 05:39:44 +00:00
from .tasks import add_adoption_notice_location
2024-08-06 15:38:17 +00:00
def user_is_trust_level_or_above(user, trust_level=User.MODERATOR):
return user.is_authenticated and user.trust_level >= User.TRUST_LEVEL[trust_level]
def user_is_owner_or_trust_level(user, django_object, trust_level=User.MODERATOR):
return user.is_authenticated and (
2024-08-08 08:50:11 +00:00
user.trust_level == User.TRUST_LEVEL[trust_level] or django_object.owner == user)
def fail_if_user_not_owner_or_trust_level(user, django_object, trust_level=User.MODERATOR):
if not user_is_owner_or_trust_level(user, django_object, trust_level):
raise PermissionDenied
2024-03-17 10:26:32 +00:00
def index(request):
2024-03-18 13:53:31 +00:00
"""View function for home page of site."""
2024-08-24 06:36:10 +00:00
latest_adoption_list = AdoptionNotice.objects.filter(
adoptionnoticestatus__major_status=AdoptionNoticeStatus.ACTIVE).order_by("-created_at")
active_adoptions = [adoption for adoption in latest_adoption_list if adoption.is_active]
2024-05-31 07:58:03 +00:00
language_code = translation.get_language()
lang = Language.objects.get(languagecode=language_code)
active_announcements = Announcement.get_active_announcements(lang)
2024-08-08 08:50:11 +00:00
context = {"adoption_notices": active_adoptions[:5], "adoption_notices_map": active_adoptions,
"announcements": active_announcements}
Text.get_texts(["how_to", "introduction"], lang, context)
2024-03-18 13:53:31 +00:00
return render(request, 'fellchensammlung/index.html', context=context)
2024-03-18 07:26:21 +00:00
2024-04-12 21:37:03 +00:00
def change_language(request):
if request.method == 'POST':
language_code = request.POST.get('language')
if language_code:
if language_code != settings.LANGUAGE_CODE and language_code in list(zip(*settings.LANGUAGES))[0]:
redirect_path = f'/{language_code}/'
elif language_code == settings.LANGUAGE_CODE:
redirect_path = '/'
else:
response = HttpResponseRedirect('/')
return response
translation.activate(language_code)
response = HttpResponseRedirect(redirect_path)
response.set_cookie(settings.LANGUAGE_COOKIE_NAME, language_code)
return response
2024-03-18 07:26:21 +00:00
def adoption_notice_detail(request, adoption_notice_id):
2024-03-20 09:35:40 +00:00
adoption_notice = AdoptionNotice.objects.get(id=adoption_notice_id)
if request.user.is_authenticated:
2024-10-05 09:22:10 +00:00
try:
subscription = Subscriptions.objects.get(owner=request.user, adoption_notice=adoption_notice)
is_subscribed = True
except Subscriptions.DoesNotExist:
is_subscribed = False
else:
is_subscribed = False
has_edit_permission = user_is_owner_or_trust_level(request.user, adoption_notice)
2024-05-30 12:37:15 +00:00
if request.method == 'POST':
action = request.POST.get("action")
2024-05-30 12:37:15 +00:00
if request.user.is_authenticated:
if action == "comment":
comment_form = CommentForm(request.POST)
if comment_form.is_valid():
comment_instance = comment_form.save(commit=False)
comment_instance.adoption_notice_id = adoption_notice_id
comment_instance.user = request.user
comment_instance.save()
2024-10-10 21:21:07 +00:00
"""Log"""
Log.objects.create(user=request.user, action="comment",
text=f"{request.user} hat Kommentar {comment_instance.pk} zur Vermittlung {adoption_notice_id} hinzugefügt")
# Auto-subscribe user to adoption notice
subscription, created = Subscriptions.objects.get_or_create(adoption_notice=adoption_notice,
owner=request.user)
subscription.save()
# Notify users that a comment was added
for subscription in adoption_notice.get_subscriptions():
# Create a notification but only if the user is not the one that posted the comment
if subscription.owner != request.user:
notification = CommentNotification(user=subscription.owner,
2024-10-05 09:22:10 +00:00
title=f"{adoption_notice.name} - Neuer Kommentar",
text=f"{request.user}: {comment_instance.text}",
comment=comment_instance)
notification.save()
else:
comment_form = CommentForm(instance=adoption_notice)
if action == "subscribe":
Subscriptions.objects.create(owner=request.user, adoption_notice=adoption_notice)
is_subscribed = True
if action == "unsubscribe":
2024-10-05 09:22:10 +00:00
subscription.delete()
is_subscribed = False
2024-05-30 12:37:15 +00:00
else:
raise PermissionDenied
else:
comment_form = CommentForm(instance=adoption_notice)
2024-10-05 09:22:10 +00:00
context = {"adoption_notice": adoption_notice, "comment_form": comment_form, "user": request.user,
"has_edit_permission": has_edit_permission, "is_subscribed": is_subscribed}
2024-03-25 10:04:01 +00:00
return render(request, 'fellchensammlung/details/detail_adoption_notice.html', context=context)
2024-03-18 07:26:21 +00:00
2024-05-30 09:47:18 +00:00
@login_required()
def adoption_notice_edit(request, adoption_notice_id):
2024-05-30 07:57:20 +00:00
"""
Form to update adoption notices
"""
adoption_notice = AdoptionNotice.objects.get(pk=adoption_notice_id)
fail_if_user_not_owner_or_trust_level(request.user, adoption_notice)
2024-05-30 07:57:20 +00:00
if request.method == 'POST':
form = AdoptionNoticeForm(request.POST, instance=adoption_notice)
2024-05-30 07:57:20 +00:00
if form.is_valid():
adoption_notice_instance = form.save()
"""Search the location given in the location string and add it to the adoption notice"""
location = Location.get_location_from_string(adoption_notice_instance.location_string)
adoption_notice_instance.location = location
adoption_notice_instance.save()
2024-10-10 21:21:07 +00:00
"""Log"""
Log.objects.create(user=request.user, action="adoption_notice_edit", text=f"{request.user} hat Vermittlung {adoption_notice.pk} geändert")
2024-05-30 07:57:20 +00:00
return redirect(reverse("adoption-notice-detail", args=[adoption_notice_instance.pk], ))
else:
form = AdoptionNoticeForm(instance=adoption_notice)
return render(request, 'fellchensammlung/forms/form-adoption-notice.html', context={"form": form})
2024-03-18 07:26:21 +00:00
2024-05-30 09:47:18 +00:00
2024-03-18 07:26:21 +00:00
def animal_detail(request, animal_id):
2024-03-19 05:15:38 +00:00
animal = Animal.objects.get(id=animal_id)
context = {"animal": animal}
2024-03-25 10:04:01 +00:00
return render(request, 'fellchensammlung/details/detail_animal.html', context=context)
2024-03-18 15:36:45 +00:00
2024-03-18 15:36:45 +00:00
def search(request):
2024-09-29 21:35:18 +00:00
place_not_found = None
2024-05-31 11:40:06 +00:00
if request.method == 'POST':
latest_adoption_list = AdoptionNotice.objects.order_by("-created_at")
active_adoptions = [adoption for adoption in latest_adoption_list if adoption.is_active]
2024-05-31 11:48:24 +00:00
search_form = AdoptionNoticeSearchForm(request.POST)
2024-05-31 11:40:06 +00:00
max_distance = int(request.POST.get('max_distance'))
if max_distance == "":
max_distance = None
geo_api = GeoAPI()
2024-10-29 16:51:28 +00:00
search_position = geo_api.get_coordinates_from_query(request.POST['location'])
if search_position is None:
2024-09-29 21:35:18 +00:00
place_not_found = True
adoption_notices_in_distance = active_adoptions
else:
adoption_notices_in_distance = [a for a in active_adoptions if a.in_distance(search_position, max_distance)]
2024-10-05 09:22:10 +00:00
context = {"adoption_notices": adoption_notices_in_distance, "search_form": search_form,
"place_not_found": place_not_found}
2024-05-31 11:40:06 +00:00
else:
latest_adoption_list = AdoptionNotice.objects.order_by("-created_at")
active_adoptions = [adoption for adoption in latest_adoption_list if adoption.is_active]
2024-05-31 11:48:24 +00:00
search_form = AdoptionNoticeSearchForm()
context = {"adoption_notices": active_adoptions, "search_form": search_form}
2024-05-31 11:48:24 +00:00
return render(request, 'fellchensammlung/search.html', context=context)
2024-04-12 21:37:03 +00:00
@login_required
def add_adoption_notice(request):
if request.method == 'POST':
2024-10-05 09:22:10 +00:00
form = AdoptionNoticeFormWithDateWidgetAutoAnimal(request.POST, request.FILES,
in_adoption_notice_creation_flow=True)
if form.is_valid():
2024-06-08 09:43:55 +00:00
instance = form.save(commit=False)
2024-08-08 11:29:20 +00:00
instance.owner = request.user
instance.save()
2024-10-10 05:39:44 +00:00
"""Spin up a task that adds the location"""
add_adoption_notice_location.delay_on_commit(instance.pk)
# Set correct status
if request.user.trust_level >= User.TRUST_LEVEL[User.COORDINATOR]:
instance.set_active()
else:
instance.set_to_review()
2024-10-05 09:22:10 +00:00
# Get the species and number of animals from the form
species = form.cleaned_data["species"]
sex = form.cleaned_data["sex"]
num_animals = form.cleaned_data["num_animals"]
date_of_birth = form.cleaned_data["date_of_birth"]
for i in range(0, num_animals):
Animal.objects.create(owner=request.user,
2024-10-05 09:22:10 +00:00
name=f"{species} {i + 1}", adoption_notice=instance, species=species, sex=sex,
date_of_birth=date_of_birth)
2024-10-10 21:21:07 +00:00
"""Log"""
Log.objects.create(user=request.user, action="add_adoption_notice",
text=f"{request.user} hat Vermittlung {instance.pk} hinzugefügt")
return redirect(reverse("adoption-notice-detail", args=[instance.pk]))
else:
form = AdoptionNoticeFormWithDateWidgetAutoAnimal(in_adoption_notice_creation_flow=True)
2024-03-25 10:04:01 +00:00
return render(request, 'fellchensammlung/forms/form_add_adoption.html', {'form': form})
2024-05-31 08:56:41 +00:00
@login_required
def adoption_notice_add_animal(request, adoption_notice_id):
# Only users that are mods or owners of the adoption notice are allowed to add to it
adoption_notice = AdoptionNotice.objects.get(pk=adoption_notice_id)
fail_if_user_not_owner_or_trust_level(request.user, adoption_notice)
if request.method == 'POST':
form = AnimalFormWithDateWidget(request.POST, request.FILES)
if form.is_valid():
instance = form.save(commit=False)
instance.adoption_notice_id = adoption_notice_id
2024-08-08 11:29:20 +00:00
instance.owner = request.user
instance.save()
form.save_m2m()
2024-05-31 08:56:41 +00:00
if "save-and-add-another-animal" in request.POST:
form = AnimalFormWithDateWidget(in_adoption_notice_creation_flow=True)
2024-05-31 08:56:41 +00:00
return render(request, 'fellchensammlung/forms/form_add_animal_to_adoption.html', {'form': form})
else:
2024-05-31 08:56:41 +00:00
return redirect(reverse("adoption-notice-detail", args=[adoption_notice_id]))
else:
form = AnimalFormWithDateWidget(in_adoption_notice_creation_flow=True)
return render(request, 'fellchensammlung/forms/form_add_animal_to_adoption.html', {'form': form})
2024-05-31 08:56:41 +00:00
@login_required
def add_photo_to_animal(request, animal_id):
animal = Animal.objects.get(id=animal_id)
# Only users that are mods or owners of the animal are allowed to add to it
fail_if_user_not_owner_or_trust_level(request.user, animal)
if request.method == 'POST':
form = ImageForm(request.POST, request.FILES)
if form.is_valid():
instance = form.save(commit=False)
instance.owner = request.user
instance.save()
animal.photos.add(instance)
2024-10-10 21:21:07 +00:00
"""Log"""
Log.objects.create(user=request.user, action="add_photo_to_animal",
text=f"{request.user} hat Foto {instance.pk} zum Tier {animal.pk} hinzugefügt")
if "save-and-add-another" in request.POST:
form = ImageForm(in_flow=True)
return render(request, 'fellchensammlung/forms/form-image.html', {'form': form})
else:
return redirect(reverse("animal-detail", args=[animal_id]))
else:
form = ImageForm(in_flow=True)
return render(request, 'fellchensammlung/forms/form-image.html', {'form': form})
@login_required
def add_photo_to_adoption_notice(request, adoption_notice_id):
adoption_notice = AdoptionNotice.objects.get(id=adoption_notice_id)
# Only users that are mods or owners of the adoption notice are allowed to add to it
fail_if_user_not_owner_or_trust_level(request.user, adoption_notice)
if request.method == 'POST':
form = ImageForm(request.POST, request.FILES)
if form.is_valid():
instance = form.save(commit=False)
instance.owner = request.user
instance.save()
adoption_notice.photos.add(instance)
2024-10-10 21:21:07 +00:00
"""Log"""
Log.objects.create(user=request.user, action="add_photo_to_animal",
text=f"{request.user} hat Foto {instance.pk} zur Vermittlung {adoption_notice.pk} hinzugefügt")
if "save-and-add-another" in request.POST:
form = ImageForm(in_flow=True)
return render(request, 'fellchensammlung/forms/form-image.html', {'form': form})
else:
return redirect(reverse("adoption-notice-detail", args=[adoption_notice_id]))
else:
return render(request, 'fellchensammlung/forms/form-image.html', {'form': form})
else:
form = ImageForm(in_flow=True)
return render(request, 'fellchensammlung/forms/form-image.html', {'form': form})
2024-05-10 11:54:16 +00:00
@login_required
def animal_edit(request, animal_id):
2024-05-10 11:54:16 +00:00
"""
View implements the following methods
* Updating an Animal
"""
2024-05-30 14:57:47 +00:00
animal = Animal.objects.get(pk=animal_id)
# Only users that are mods or owners of the animal are allowed to edit it
fail_if_user_not_owner_or_trust_level(request.user, animal)
2024-05-10 11:54:16 +00:00
if request.method == 'POST':
2024-05-30 14:57:47 +00:00
form = AnimalForm(request.POST, instance=animal)
2024-05-10 11:54:16 +00:00
2024-05-30 14:57:47 +00:00
if form.is_valid():
animal = form.save()
2024-10-10 21:21:07 +00:00
"""Log"""
Log.objects.create(user=request.user, action="add_photo_to_animal",
text=f"{request.user} hat Tier {animal.pk} zum Tier geändert")
2024-05-30 14:57:47 +00:00
return redirect(reverse("animal-detail", args=[animal.pk], ))
else:
2024-05-30 14:57:47 +00:00
form = AnimalForm(instance=animal)
return render(request, 'fellchensammlung/forms/form-adoption-notice.html', context={"form": form})
2024-03-18 15:36:45 +00:00
2024-03-18 15:41:22 +00:00
def about(request):
2024-03-20 10:02:24 +00:00
rules = Rule.objects.all()
2024-04-14 12:39:49 +00:00
2024-04-14 13:45:57 +00:00
language_code = translation.get_language()
lang = Language.objects.get(languagecode=language_code)
2024-04-14 12:39:49 +00:00
legal = {}
for text_code in ["terms_of_service", "privacy_statement", "imprint"]:
try:
2024-05-01 08:09:36 +00:00
legal[text_code] = Text.objects.get(text_code=text_code, language=lang, )
2024-04-14 12:39:49 +00:00
except Text.DoesNotExist:
legal[text_code] = None
2024-05-01 08:09:36 +00:00
context = {"rules": rules, }
2024-04-14 12:39:49 +00:00
context.update(legal)
2024-03-18 15:41:22 +00:00
return render(
request,
"fellchensammlung/about.html",
context=context
)
2024-03-22 11:45:50 +00:00
def report_adoption(request, adoption_notice_id):
"""
Form to report adoption notices
"""
if request.method == 'POST':
form = ReportAdoptionNoticeForm(request.POST)
2024-03-22 11:45:50 +00:00
if form.is_valid():
report_instance = form.save(commit=False)
report_instance.adoption_notice_id = adoption_notice_id
report_instance.status = Report.WAITING
report_instance.save()
form.save_m2m()
mail_admins_new_report(report_instance)
2024-03-22 11:45:50 +00:00
return redirect(reverse("report-detail-success", args=[report_instance.pk], ))
else:
form = ReportAdoptionNoticeForm()
return render(request, 'fellchensammlung/forms/form-report.html', {'form': form})
def report_comment(request, comment_id):
"""
Form to report comments
"""
if request.method == 'POST':
form = ReportCommentForm(request.POST)
if form.is_valid():
report_instance = form.save(commit=False)
report_instance.reported_comment_id = comment_id
report_instance.status = Report.WAITING
report_instance.save()
form.save_m2m()
mail_admins_new_report(report_instance)
return redirect(reverse("report-detail-success", args=[report_instance.pk], ))
else:
form = ReportCommentForm()
2024-03-25 10:04:01 +00:00
return render(request, 'fellchensammlung/forms/form-report.html', {'form': form})
2024-03-22 11:45:50 +00:00
def report_detail(request, report_id, form_complete=False):
"""
Detailed view of a report, including moderation actions
"""
report = Report.objects.get(pk=report_id)
moderation_actions = ModerationAction.objects.filter(report_id=report_id)
context = {"report": report, "moderation_actions": moderation_actions, "form_complete": form_complete}
2024-03-25 10:04:01 +00:00
return render(request, 'fellchensammlung/details/detail-report.html', context)
2024-03-22 11:45:50 +00:00
def report_detail_success(request, report_id):
"""
Calls the report detail view with form_complete set to true, so success message shows
"""
return report_detail(request, report_id, form_complete=True)
2024-08-06 15:38:17 +00:00
@login_required
def user_detail(request, user_id):
user = User.objects.get(id=user_id)
# Only users that are mods or owners of the user are allowed to view
fail_if_user_not_owner_or_trust_level(request.user, user)
if request.method == "POST":
action = request.POST.get("action")
if action == "notification_mark_read":
notification_id = request.POST.get("notification_id")
2024-08-03 07:02:09 +00:00
notification = CommentNotification.objects.get(pk=notification_id)
notification.read = True
notification.save()
elif action == "notification_mark_all_read":
2024-08-03 07:02:09 +00:00
notifications = CommentNotification.objects.filter(user=request.user, mark_read=False)
for notification in notifications:
notification.read = True
notification.save()
2024-08-02 18:44:33 +00:00
context = {"user": user,
"adoption_notices": AdoptionNotice.objects.filter(owner=user),
2024-08-03 07:02:09 +00:00
"notifications": CommentNotification.objects.filter(user=user, read=False)}
return render(request, 'fellchensammlung/details/detail-user.html', context=context)
2024-04-07 07:03:20 +00:00
@user_passes_test(user_is_trust_level_or_above)
2024-04-07 07:03:20 +00:00
def modqueue(request):
open_reports = Report.objects.filter(status=Report.WAITING)
context = {"reports": open_reports}
return render(request, 'fellchensammlung/modqueue.html', context=context)
2024-06-06 21:16:57 +00:00
2024-10-05 09:22:10 +00:00
@login_required
def updatequeue(request):
2024-10-10 21:21:07 +00:00
#TODO: Make sure update can only be done for instances with permission
if request.method == "POST":
print(request.POST.get("adoption_notice_id"))
adoption_notice = AdoptionNotice.objects.get(id=request.POST.get("adoption_notice_id"))
action = request.POST.get("action")
print(f"Action: {action}")
if action == "checked_inactive":
adoption_notice.set_closed()
elif action == "checked_active":
print("set checked")
adoption_notice.set_checked()
if user_is_trust_level_or_above(request.user, User.MODERATOR):
last_checked_adoption_list = AdoptionNotice.objects.order_by("last_checked")
else:
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]
context = {"adoption_notices": adoption_notices}
return render(request, 'fellchensammlung/updatequeue.html', context=context)
2024-06-06 21:16:57 +00:00
2024-08-24 06:36:10 +00:00
def map(request):
2024-10-05 09:22:10 +00:00
adoption_notices = AdoptionNotice.objects.all() #TODO: Filter to active
context = {"adoption_notices_map": adoption_notices}
return render(request, 'fellchensammlung/map.html', context=context)
2024-08-24 06:36:10 +00:00
2024-06-06 21:16:57 +00:00
def metrics(request):
data = gather_metrics_data()
return JsonResponse(data)
2024-10-05 09:22:10 +00:00
@login_required
def instance_health_check(request):
"""
Allows an administrator to check common problems of an instance
"""
if request.method == "POST":
action = request.POST.get("action")
if action == "clean_locations":
clean_locations(quiet=False)
elif action == "deactivate_unchecked_adoption_notices":
deactivate_unchecked_adoption_notices()
number_of_adoption_notices = AdoptionNotice.objects.all().count()
none_geocoded_adoption_notices = AdoptionNotice.objects.filter(location__isnull=True)
number_not_geocoded_adoption_notices = len(none_geocoded_adoption_notices)
number_of_rescue_orgs = RescueOrganization.objects.all().count()
none_geocoded_rescue_orgs = RescueOrganization.objects.filter(location__isnull=True)
number_not_geocoded_rescue_orgs = len(none_geocoded_rescue_orgs)
2024-09-28 22:20:08 +00:00
unchecked_ans = get_unchecked_adoption_notices()
number_unchecked_ans = len(unchecked_ans)
2024-09-28 22:20:08 +00:00
# CHECK FOR MISSING TEXTS
languages = Language.objects.all()
texts = Text.objects.all()
text_codes = set([text.text_code for text in texts])
missing_texts = []
for language in languages:
for text_code in text_codes:
try:
Text.objects.get(text_code=text_code, language=language)
except Text.DoesNotExist:
missing_texts.append((text_code, language))
# Timestamps
timestamps = Timestamp.objects.all()
context = {
"number_of_adoption_notices": number_of_adoption_notices,
"number_not_geocoded_adoption_notices": number_not_geocoded_adoption_notices,
"none_geocoded_adoption_notices": none_geocoded_adoption_notices,
"number_of_rescue_orgs": number_of_rescue_orgs,
2024-09-28 22:20:08 +00:00
"number_not_geocoded_rescue_orgs": number_not_geocoded_rescue_orgs,
"none_geocoded_rescue_orgs": none_geocoded_rescue_orgs,
"missing_texts": missing_texts,
"number_unchecked_ans": number_unchecked_ans,
"unchecked_ans": unchecked_ans,
"timestamps": timestamps
}
2024-09-28 22:20:08 +00:00
return render(request, 'fellchensammlung/instance-health-check.html', context=context)
2024-10-05 09:22:10 +00:00
def external_site_warning(request):
url = request.GET.get("url")
context = {"url": url}
language_code = translation.get_language()
lang = Language.objects.get(languagecode=language_code)
Text.get_texts(["external_site_warning", "good_adoption_practices"], language=lang)
return render(request, 'fellchensammlung/external_site_warning.html', context=context)