[geany/www.geany.org] 828312: Add LatestVersion support for Geany-Plugins

Enrico Tröger git-noreply at xxxxx
Sun Sep 27 21:50:30 UTC 2020


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Sun, 27 Sep 2020 21:50:30 UTC
Commit:      828312e63a47161d0f9f7b60fa32278aa87f388e
             https://github.com/geany/www.geany.org/commit/828312e63a47161d0f9f7b60fa32278aa87f388e

Log Message:
-----------
Add LatestVersion support for Geany-Plugins

Use the Geany-Plugins version information on the download page for
the release notes link.


Modified Paths:
--------------
    latest_version/context_processors.py
    latest_version/fixtures/first_plugins_version.json
    latest_version/migrations/0002_latestversion_name.py
    latest_version/models.py
    page_content/download/releases.md

Modified: latest_version/context_processors.py
11 lines changed, 9 insertions(+), 2 deletions(-)
===================================================================
@@ -22,7 +22,13 @@
 # ----------------------------------------------------------------------
 @cache_function(CACHE_TIMEOUT_1HOUR, ignore_arguments=True)
 def latest_version(request):
-    geany_latest_version = LatestVersion.objects.get(id=1)
+    latest_versions = LatestVersion.objects.all()
+    latest_versions_by_name = {
+        latest_version.name: latest_version
+        for latest_version
+        in latest_versions}
+    geany_latest_version = latest_versions_by_name.get('Geany')
+    geany_plugins_latest_version = latest_versions_by_name.get('Geany-Plugins')
 
     # Geany
     release_versions_provider = ReleaseVersionsProvider(
@@ -32,10 +38,11 @@ def latest_version(request):
     # Geany-Plugins
     geany_plugins_release_versions_provider = ReleaseVersionsProvider(
         settings.LATEST_VERSION_PLUGINS_RELEASES_DIRECTORY,
-        fallback_version=geany_latest_version.version)
+        fallback_version=geany_plugins_latest_version.version)
     plugins_release_versions = geany_plugins_release_versions_provider.provide()
 
     return dict(
         geany_latest_version=geany_latest_version,
+        geany_plugins_latest_version=geany_plugins_latest_version,
         release_versions=release_versions,
         plugins_release_versions=plugins_release_versions)


Modified: latest_version/fixtures/first_plugins_version.json
12 lines changed, 12 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,12 @@
+[
+  {
+    "model": "latest_version.latestversion",
+    "pk": 2,
+    "fields": {
+      "name": "Geany-Plugins",
+      "version": "1.36.0",
+      "github_link": "/commits/1.36.0",
+      "release_date": "2020-09-28T14:12:00Z"
+    }
+  }
+]


Modified: latest_version/migrations/0002_latestversion_name.py
19 lines changed, 19 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,19 @@
+# Generated by Django 2.2.16 on 2020-09-27 21:36
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('latest_version', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='latestversion',
+            name='name',
+            field=models.CharField(default='Geany', max_length=50, unique=True),
+            preserve_default=False,
+        ),
+    ]


Modified: latest_version/models.py
9 lines changed, 2 insertions(+), 7 deletions(-)
===================================================================
@@ -17,6 +17,7 @@
 
 class LatestVersion(models.Model):
 
+    name = models.CharField(max_length=50, unique=True)
     version = models.CharField(max_length=50, verbose_name='Latest Geany version')
     release_date = models.DateTimeField()
     github_link = models.CharField(
@@ -28,16 +29,10 @@ class Meta:
         verbose_name = 'Latest Version'
         verbose_name_plural = 'Latest Version'
 
-    # ----------------------------------------------------------------------
-    def save(self, *args, **kwargs):  # pylint: disable=signature-differs
-        """Save but replace the existing row instead of adding a new one"""
-        self.id = 1  # pylint: disable=invalid-name,attribute-defined-outside-init
-        super().save(*args, **kwargs)
-
     # ----------------------------------------------------------------------
     def delete(self, using=None, keep_parents=False):
         """Never delete anything"""
 
     # ----------------------------------------------------------------------
     def __str__(self):
-        return 'Geany {}'.format(self.version)
+        return '{} {}'.format(self.name, self.version)


Modified: page_content/download/releases.md
3 lines changed, 3 insertions(+), 0 deletions(-)
===================================================================
@@ -22,6 +22,8 @@ Source (tar.bz2)  | [{{ plugins_release_versions.source_bzip2_version }}](https:
 Windows           | [{{ plugins_release_versions.windows_version }}](https://plugins.geany.org/geany-plugins/{{ plugins_release_versions.windows_version }}) | [{{ plugins_release_versions.windows_version }}.sig](https://plugins.geany.org/geany-plugins/{{ plugins_release_versions.windows_version }}.sig) ([Instructions][4]) | [frlan-pubkey.txt][6]
 Mac OSX           | (included in `{{ release_versions.macos_version }}` above) | - | -
 
+[Release notes for Geany-Plugins {{ geany_plugins_latest_version.version }}][7]
+
 For more details, see the [plugin page][5].
 
 
@@ -42,3 +44,4 @@ For older versions, please see https://download.geany.org/.
 [4]: /support/verify-gpg-signature/
 [5]: /support/plugins/
 [6]: https://download.geany.org/frlan-pubkey.txt
+[7]: https://raw.githubusercontent.com/geany/geany-plugins/{{ geany_plugins_latest_version.version }}/NEWS



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list