context_processors.py 685 B

12345678910111213141516171819202122
  1. from django.urls import reverse
  2. from misago.conf import settings
  3. def legal_links(request):
  4. legal_context = {}
  5. if settings.terms_of_service_link:
  6. legal_context['TERMS_OF_SERVICE_URL'] = settings.terms_of_service_link
  7. elif settings.terms_of_service:
  8. legal_context['TERMS_OF_SERVICE_URL'] = reverse('misago:terms-of-service')
  9. if settings.privacy_policy_link:
  10. legal_context['PRIVACY_POLICY_URL'] = settings.privacy_policy_link
  11. elif settings.privacy_policy:
  12. legal_context['PRIVACY_POLICY_URL'] = reverse('misago:privacy-policy')
  13. if legal_context:
  14. request.frontend_context.update(legal_context)
  15. return legal_context