context_processors.py 711 B

1234567891011121314151617181920212223
  1. from django.core.urlresolvers 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(
  9. 'misago:terms-of-service')
  10. if settings.privacy_policy_link:
  11. legal_context['PRIVACY_POLICY_URL'] = settings.privacy_policy_link
  12. elif settings.privacy_policy:
  13. legal_context['PRIVACY_POLICY_URL'] = reverse('misago:privacy-policy')
  14. if legal_context:
  15. request.frontend_context.update(legal_context)
  16. return legal_context