Parcourir la source

Test if the SITE_URL end by slash and if true, remove end slash

neodarz il y a 7 ans
Parent
commit
c6299c92da
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3 1
      wifiwithme/apps/contribmap/views.py

+ 3 - 1
wifiwithme/apps/contribmap/views.py

@@ -11,6 +11,7 @@ from .forms import PublicContribForm
 from .models import Contrib
 from .decorators import prevent_robots
 
+import re
 
 @prevent_robots()
 def add_contrib(request):
@@ -25,7 +26,8 @@ def add_contrib(request):
             # Send notification email
             if len(settings.NOTIFICATION_EMAILS) > 0:
                 context = {
-                    'site_url': str(settings.SITE_URL) + "/map/#" + str(contrib.id),
+                    'site_url': re.sub("/$", "", str(settings.SITE_URL))
+                                + "/map/#" + str(contrib.id),
                     'contrib': contrib,
                 }
                 subject = get_template(