From 162a864d45608f251bb45aa3e201d4105ecd1dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Loks?= Date: Sat, 12 Nov 2016 17:53:02 +0000 Subject: [PATCH] Allow to hide donation pages to MapOSMatic project --- www/maposmatic/context_processors.py | 1 + www/maposmatic/views.py | 4 ++++ www/settings.py | 3 +++ www/settings_local.py.dist | 3 +++ www/templates/maposmatic/base.html | 2 +- www/templates/maposmatic/index.html | 2 ++ 6 files changed, 14 insertions(+), 1 deletion(-) diff --git a/www/maposmatic/context_processors.py b/www/maposmatic/context_processors.py index ef957f2b..a1201f17 100644 --- a/www/maposmatic/context_processors.py +++ b/www/maposmatic/context_processors.py @@ -105,6 +105,7 @@ def all(request): 'BRAND_NAME': www.settings.BRAND_NAME, 'CONTACT_EMAIL': www.settings.CONTACT_EMAIL, 'EXTRA_FOOTER': www.settings.EXTRA_FOOTER, + 'MAPOSMATIC_DONATION': www.settings.MAPOSMATIC_DONATION, 'BBOX_MAXIMUM_LENGTH_IN_METERS': www.settings.BBOX_MAXIMUM_LENGTH_IN_METERS, 'searchform': forms.MapSearchForm(request.GET), diff --git a/www/maposmatic/views.py b/www/maposmatic/views.py index b4227ca1..250af027 100644 --- a/www/maposmatic/views.py +++ b/www/maposmatic/views.py @@ -73,11 +73,15 @@ def about(request): def donate(request): """The donate page.""" + if not www.settings.MAPOSMATIC_DONATION: + return HttpResponseRedirect(reverse('main')) return render_to_response('maposmatic/donate.html', context_instance=RequestContext(request)) def donate_thanks(request): """The thanks for donation page.""" + if not www.settings.MAPOSMATIC_DONATION: + return HttpResponseRedirect(reverse('main')) return render_to_response('maposmatic/donate-thanks.html', context_instance=RequestContext(request)) diff --git a/www/settings.py b/www/settings.py index 47b147ff..8fbe695c 100644 --- a/www/settings.py +++ b/www/settings.py @@ -323,6 +323,9 @@ CONTACT_EMAIL = "" # If you want to provide extra information in the footer put it in EXTRA_FOOTER EXTRA_FOOTER = "" +# Show a link to donate to the MapOSMatic team +MAPOSMATIC_DONATION = False + try: from settings_local import * except ImportError: diff --git a/www/settings_local.py.dist b/www/settings_local.py.dist index a3f806c2..4a28bdac 100644 --- a/www/settings_local.py.dist +++ b/www/settings_local.py.dist @@ -116,6 +116,9 @@ https://docs.djangoproject.com/en/1.8/ref/settings/ # DAEMON_ERRORS_EMAIL_REPLY_TO = 'noreply@domain.com' # DAEMON_ERRORS_JOB_URL = 'http://domain.com/jobs/%d' +# # Show a link to donate to the MapOSMatic team +# MAPOSMATIC_DONATION = False + # # Displayed on the top menu # BRAND_NAME = "MapOSMatic" # # Front page feed diff --git a/www/templates/maposmatic/base.html b/www/templates/maposmatic/base.html index 02dcf96b..3c6d9218 100644 --- a/www/templates/maposmatic/base.html +++ b/www/templates/maposmatic/base.html @@ -70,7 +70,7 @@ - + {% if MAPOSMATIC_DONATION %}{% endif %}