8000 Adding latest sources to Sources box on Download page · pythonanywhere/pythondotorg@a3b3e4a · GitHub
[go: up one dir, main page]

Skip to content

Commit a3b3e4a

Browse files
committed
Adding latest sources to Sources box on Download page
1 parent 675f959 commit a3b3e4a

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

downloads/models.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,24 @@ def update_supernav():
120120
box.content = content
121121
box.save()
122122

123+
# Update latest Sources box on Download landing page
124+
if latest_python2:
125+
latest_python2_source = latest_python2.download_file_for_os('source')
126+
else:
127+
latest_python2_source = None
128+
129+
if latest_python3:
130+
latest_python3_source = latest_python3.download_file_for_os('source')
131+
else:
132+
latest_python3_source = None
133+
134+
source_box = Box.objects.get(label='download-sources')
135+
source_content = render_to_string('downloads/download-sources-box.html',{
136+
'latest_python2_source': latest_python2_source,
137+
'latest_python3_source': latest_python3_source,
138+
})
139+
source_box.content = source_content
140+
source_box.save()
123141

124142
def update_homepage_download_box():
125143
try:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<h2 class="widget-title">Sources</h2>
2+
<p>For most Unix systems, you must download and compile the source code. The same source code archive can also be used to build the Windows and Mac versions, and is the starting point for ports to all other platforms.</p>
3+
4+
<p>Download the latest <a href="{{ latest_python2_source.url }}">Python 2</a> and <a href="{{ latest_python3_source.url }}">Python 3</a> source.</p>
5+
6+
<p><a class="readmore" href="/download/source/">Read more</a></p>

templates/downloads/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ <h2 class="widget-title">Looking for a specific release?</h2>
6767
</div>
6868

6969
<div class="small-widget download-widget2">
70-
{% box 'download-widget2' %}
70+
{% box 'download-sources' %}
7171

7272
</div>
7373

0 commit comments

Comments
 (0)
0