Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #21028 - added support to the site for LTS releases.

  • Loading branch information...
commit a95eacf7867126223e01da03ff6a9dbc1cc242df 1 parent 0500018
@jacobian jacobian authored
View
36 releases/migrations/0004_auto__add_field_release_is_lts.py
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Adding field 'Release.is_lts'
+ db.add_column(u'releases_release', 'is_lts',
+ self.gf('django.db.models.fields.BooleanField')(default=False),
+ keep_default=False)
+
+
+ def backwards(self, orm):
+ # Deleting field 'Release.is_lts'
+ db.delete_column(u'releases_release', 'is_lts')
+
+
+ models = {
+ u'releases.release': {
+ 'Meta': {'object_name': 'Release'},
+ 'date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today'}),
+ 'is_lts': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'iteration': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
+ 'major': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
+ 'micro': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
+ 'minor': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
+ 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
+ 'version': ('django.db.models.fields.CharField', [], {'max_length': '16', 'primary_key': 'True'})
+ }
+ }
+
+ complete_apps = ['releases']
View
5 releases/models.py
@@ -21,6 +21,9 @@ def final(self):
def current(self):
return self.final().order_by('-minor', '-micro')[0]
+ def lts(self):
+ return self.final().order_by('-minor', '-micro').filter(is_lts=True)[0]
+
def current_version(self):
current_version = cache.get(Release.DEFAULT_CACHE_KEY, None)
if current_version is None:
@@ -56,6 +59,8 @@ class Release(models.Model):
status = models.CharField(max_length=1, choices=STATUS_CHOICES, editable=False)
iteration = models.PositiveSmallIntegerField(editable=False)
+ is_lts = models.BooleanField("Long term support release", default=False)
+
objects = ReleaseManager()
def save(self, *args, **kwargs):
View
11 releases/views.py
@@ -30,10 +30,19 @@ def index(request):
'c': 'release candidate',
}[preview.status]
+ # Look for an LTS release, if there is one.
+ try:
+ lts = Release.objects.lts()
+ except IndexError:
+ lts = None
+ if lts == previous:
+ lts = None
+
context = {
'current_version': current.version,
'previous_version': previous.version,
- 'earlier_versions': [release.version for release in reversed(releases)],
+ 'lts_version': lts.version if lts else None,
+ 'earlier_versions': [release.version for release in reversed(releases) if release != lts],
'preview_version': preview_version,
'preview_kind': preview_kind,
}
View
3  templates/releases/download.html
@@ -65,6 +65,9 @@
<h2>Previous releases</h2>
<ul>
<li>Django {{ previous_version }}: <a href="{% url 'download-redirect' previous_version 'tarball' %}">Django-{{ previous_version }}.tar.gz</a><br>Checksum: <a href="{% url 'download-redirect' previous_version 'checksum' %}">Django-{{ previous_version }}.checksum.txt</a></li>
+ {% if lts_version %}
+ <li>Django {{ lts_version }} (LTS): <a href="{% url 'download-redirect' lts_version 'tarball' %}">Django-{{ lts_version }}.tar.gz</a><br>Checksum: <a href="{% url 'download-redirect' lts_version 'checksum' %}">Django-{{ lts_version }}.checksum.txt</a></li>
+ {% endif %}
</ul>
<h2>Unsupported previous releases (no longer receive security updates or bugfixes)</h2>
Please sign in to comment.
Something went wrong with that request. Please try again.