[geany/www.geany.org] a68aac: Update nightlybuilds app
Enrico Tröger
git-noreply at xxxxx
Sat May 11 13:15:48 UTC 2019
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger at uvena.de>
Committer: Enrico Tröger <enrico.troeger at uvena.de>
Date: Sun, 31 Mar 2019 14:09:21 UTC
Commit: a68aac442a4a17ba24adc394577bdcd9097eb012
https://github.com/geany/www.geany.org/commit/a68aac442a4a17ba24adc394577bdcd9097eb012
Log Message:
-----------
Update nightlybuilds app
Modified Paths:
--------------
nightlybuilds/database_routers.py
nightlybuilds/models.py
nightlybuilds/templatetags/nightlybuilds_tags.py
nightlybuilds/views.py
Modified: nightlybuilds/database_routers.py
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -48,5 +48,5 @@ def allow_relation(self, obj1, obj2, **hints):
return None
#----------------------------------------------------------------------
- def allow_migrate(self, db, model):
- return model._meta.app_label != 'nightlybuilds'
+ def allow_migrate(self, db, app_label, model_name=None, **hints):
+ return app_label != 'nightlybuilds'
Modified: nightlybuilds/models.py
13 lines changed, 9 insertions(+), 4 deletions(-)
===================================================================
@@ -3,12 +3,12 @@
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
-#
+#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -19,12 +19,17 @@
class NightlyBuildTarget(models.Model):
nightly_build_target_id = models.PositiveIntegerField(primary_key=True)
+ active = models.BooleanField()
project = models.CharField(max_length=50)
identifier = models.CharField(max_length=50)
name = models.CharField(max_length=50)
arch = models.CharField(max_length=50)
folder = models.CharField(max_length=50)
- last_nightly_build = models.ForeignKey('NightlyBuild', null=True, blank=True)
+ last_nightly_build = models.ForeignKey(
+ 'NightlyBuild',
+ null=True,
+ blank=True,
+ on_delete=models.PROTECT)
########################################################################
class Meta:
@@ -40,7 +45,7 @@ def __unicode__(self):
class NightlyBuild(models.Model):
nightly_build_id = models.PositiveIntegerField(primary_key=True)
- nightly_build_target = models.ForeignKey('NightlyBuildTarget')
+ nightly_build_target = models.ForeignKey('NightlyBuildTarget', on_delete=models.PROTECT)
status = models.BooleanField()
revision = models.CharField(max_length=255)
compiler_version = models.CharField(max_length=50)
Modified: nightlybuilds/templatetags/nightlybuilds_tags.py
16 lines changed, 11 insertions(+), 5 deletions(-)
===================================================================
@@ -3,17 +3,18 @@
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
-#
+#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django import template
from django.conf import settings
+from django.utils.html import format_html
import os
@@ -37,8 +38,11 @@ def get_build_log(nightly_build, log_type):
pass
else:
if size > 0:
- path = u'%s/%s' % (nightly_build.nightly_build_target.folder, log)
- return u'<a href="%s">%s</stdout>' % (path, log_type)
+ return format_html(
+ u'<a href="/{}/{}">{}</stdout>',
+ nightly_build.nightly_build_target.folder,
+ log,
+ log_type)
return u''
@@ -47,6 +51,8 @@ def get_build_log(nightly_build, log_type):
def get_details(nightly_build):
header_txt = os.path.join(base_dir, nightly_build.nightly_build_target.folder, 'HEADER.txt')
if os.path.exists(header_txt):
- return u'<a href="/%s/">Details</a>' % (nightly_build.nightly_build_target.folder)
+ return format_html(
+ u'<a href="/{}/">Details</a>',
+ nightly_build.nightly_build_target.folder)
else:
return u''
Modified: nightlybuilds/views.py
5 lines changed, 3 insertions(+), 2 deletions(-)
===================================================================
@@ -3,12 +3,12 @@
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
-#
+#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -25,5 +25,6 @@ class NightlyBuildsView(ListView):
queryset = NightlyBuild.objects.\
prefetch_related('nightly_build_target').\
+ filter(nightly_build_target__active=1).\
filter(nightly_build_target__last_nightly_build_id=F('nightly_build_id')).\
order_by('nightly_build_target__project', 'nightly_build_target__identifier')
--------------
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