File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change
1
+ from django .conf import settings
2
+
3
+
4
+ def display_preview_banner (request ):
5
+ """
6
+ Determines if a banner should be displayed to help the website teams
7
+ distinguish between the preview and production sites. The banner is
8
+ based on the domain name configured in settings, if any, and will
9
+ appear on https://*.preview.djangoproject.com/ (but not
10
+ https://*.djangoproject.com/ nor in local development).
11
+ """
12
+ production_tld = "djangoproject.com"
13
+ # Note: DOMAIN_NAME is not defined in local development
14
+ domain_name = getattr (settings , "DOMAIN_NAME" , production_tld )
15
+ return {
16
+ "DISPLAY_PREVIEW_BANNER" : domain_name != production_tld ,
17
+ }
Original file line number Diff line number Diff line change 209
209
"docs.context_processors.docs_version" ,
210
210
"releases.context_processors.django_version" ,
211
211
"aggregator.context_processors.community_stats" ,
212
+ "djangoproject.context_processors.display_preview_banner" ,
212
213
"django.template.context_processors.request" ,
213
214
],
214
215
},
Original file line number Diff line number Diff line change
1
+ {% if DISPLAY_PREVIEW_BANNER %}
2
+ < div class ="copy-banner " style ="background: #fff78e; padding: 10px; "> </ div >
3
+ {% endif %}
1
4
< header id ="top ">
2
5
< div class ="container container--flex--wrap--mobile ">
3
6
< a class ="logo " href ="{% url 'homepage' %} "> Django</ a >
You can’t perform that action at this time.
0 commit comments