Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Automate the download page for preview releases.

  • Loading branch information...
commit 291fd575a8994aee954dac97b7489544b3be7ec0 1 parent 10f0828
@aaugustin aaugustin authored
View
5 releases/models.py
@@ -12,8 +12,11 @@
class ReleaseManager(models.Manager):
+ def preview(self):
+ return self.filter(major=1).exclude(status='f')
+
def final(self):
- return self.filter(status='f', major=1)
+ return self.filter(major=1, status='f')
def current(self):
return self.final().order_by('-minor', '-micro')[0]
View
18 releases/views.py
@@ -14,10 +14,28 @@ def index(request):
releases = [releases[minor] for minor in sorted(releases)]
current = releases.pop()
previous = releases.pop()
+ # Handle preview releases
+ try:
+ preview = (Release.objects.preview()
+ .filter(minor__gt=current.minor)
+ .order_by('-minor', '-micro', '-status', '-iteration'))[0]
+ except Release.DoesNotExist:
+ preview_version = None
+ preview_kind = None
+ else:
+ preview_version = preview.version
+ preview_kind = {
+ 'a': 'alpha',
+ 'b': 'beta',
+ 'c': 'release candidate',
+ }[preview.status]
+
context = {
'current_version': current.version,
'previous_version': previous.version,
'earlier_versions': [release.version for release in reversed(releases)],
+ 'preview_version': preview_version,
+ 'preview_kind': preview_kind,
}
return render(request, 'releases/download.html', context)
View
20 templates/releases/download.html
@@ -11,7 +11,7 @@
<p>Django is available open-source under the <a href="https://github.com/django/django/blob/master/LICENSE">BSD license</a>. It requires Python version 2.6.5 or higher, but it has no dependencies on other Python libraries. There are several ways you can get it:</p>
-<h2>Option 1. Get the latest official version</h2>
+<h2>Option {% cycle '1' '2' '3' as options %}. Get the latest official version</h2>
<p>The latest official version is {{ current_version }}. You can get it by direct download:
@@ -25,7 +25,23 @@
<pre class="literal-block"><code>pip install Django=={{ current_version }}</code></pre>
-<h2>Option 2. Get the latest development version</h2>
+{% if preview_version %}
+<h2>Option {% cycle options %}. Get the {{ preview_kind }} for {{ preview_version|slice:":3" }}</h2>
+
+<p>As part of the Django {{ preview_version|slice:":3" }} development process, Django {{ preview_version }} is available. This release is only for experienced users who want to try out the new version and help identify any remaining bugs prior to the {{ preview_version|slice:":3" }} release. Please read the {{ preview_version|slice:":3" }} release notes before using this package.
+
+<p>To try out the {{ preview_kind }}, download <a href="{% url 'download-redirect' preview_version 'tarball' %}">Django-{{ preview_version }}.tar.gz</a> (<a href="{% url 'download-redirect' preview_version 'checksum' %}">checksums</a>). Then:</p>
+
+<pre class="literal-block"><code>tar xzvf Django-{{ preview_version }}.tar.gz
+cd Django-{{ preview_version }}
+sudo python setup.py install</code></pre>
+
+<p>You can also use <a href="http://www.pip-installer.org/en/latest/">pip</a>:
+
+<pre class="literal-block"><code>pip install Django=={{ preview_version }}</code></pre>
+{% endif %}
+
+<h2>Option {% cycle options %}. Get the latest development version</h2>
<p>The latest and greatest Django version is the one that's in our Git repository (our revision-control system). Get it using this shell command, which requires <a href="http://git-scm.com/">Git</a>:</p>
Please sign in to comment.
Something went wrong with that request. Please try again.