Commit 875d50d8 authored by Jelle van der Waa's avatar Jelle van der Waa 🚧 Committed by Angel Velásquez
Browse files

Remove unused Iso Model (#82)

The ISO model was used for the releng feedback form which was removed
earlier. All this code is therefore now unused.
parent 15e4f753
......@@ -229,21 +229,6 @@
"fields": {
"name": "Release Engineering",
"permissions": [
from django.contrib import admin
from .models import (Iso, Release)
class IsoAdmin(admin.ModelAdmin):
list_display = ('name', 'created', 'active', 'removed')
list_filter = ('active', 'created')
date_hierarchy = 'created'
class TestAdmin(admin.ModelAdmin):
list_display = ('user_name', 'user_email', 'created', 'ip_address',
'iso', 'success')
list_filter = ('success', 'iso')
from .models import Release
class ReleaseAdmin(admin.ModelAdmin):
list_display = ('version', 'release_date', 'kernel_version', 'available',
......@@ -19,7 +9,6 @@ class ReleaseAdmin(admin.ModelAdmin):
readonly_fields = ('created', 'last_modified'), IsoAdmin), ReleaseAdmin)
# vim: set ts=4 sw=4 et:
import re
import urllib
from HTMLParser import HTMLParser, HTMLParseError
from django.conf import settings
from import BaseCommand, CommandError
from django.utils.timezone import now
from releng.models import Iso
class IsoListParser(HTMLParser):
def __init__(self):
self.hyperlinks = []
self.url_re = re.compile('(?!\.{2})/$')
def handle_starttag(self, tag, attrs):
if tag != 'a':
for name, value in attrs:
if name != "href":
if value != '../' and is not None:
def parse(self, url):
remote_file = urllib.urlopen(url)
data =
return self.hyperlinks
except HTMLParseError:
raise CommandError('Couldn\'t parse "%s"' % url)
class Command(BaseCommand):
help = 'Gets new ISOs from %s' % settings.ISO_LIST_URL
def handle(self, *args, **options):
parser = IsoListParser()
isonames = Iso.objects.values_list('name', flat=True)
active_isos = parser.parse(settings.ISO_LIST_URL)
except IOError as e:
print('Unable to fetch active isos from {}'.format(settings.ISO_LIST_URL))
if options.get('verbosity') > 1:
for iso in active_isos:
# create any names that don't already exist
if iso not in isonames:
new = Iso(name=iso, active=True)
# update those that do if they were marked inactive
existing = Iso.objects.get(name=iso)
if not = True
existing.removed = None'active', 'removed'))
# and then mark all other names as no longer active
active=False, removed=now())
# vim: set ts=4 sw=4 et:
......@@ -13,22 +13,6 @@
from main.utils import set_created_field, parse_markdown
class Iso(models.Model):
name = models.CharField(max_length=255)
created = models.DateTimeField(editable=False)
removed = models.DateTimeField(null=True, blank=True, default=None)
active = models.BooleanField(default=True)
def get_absolute_url(self):
return reverse('releng-results-iso', args=[])
def __unicode__(self):
class Meta:
verbose_name = 'ISO'
class Release(models.Model):
release_date = models.DateField(db_index=True)
version = models.CharField(max_length=50, unique=True)
......@@ -103,8 +87,6 @@ def torrent(self):
return metadata
for model in (Iso, Release):
pre_save.connect(set_created_field, sender=model,
pre_save.connect(set_created_field, sender=Release, dispatch_uid="releng.models")
# vim: set ts=4 sw=4 et:
......@@ -3,35 +3,14 @@
from django.core.serializers.json import DjangoJSONEncoder
from django.core.urlresolvers import reverse
from django.db.models import Count
from django.http import Http404, HttpResponse
from django.shortcuts import get_object_or_404, render
from django.views.generic import DetailView, ListView
from .models import (Iso, Release)
from .models import Release
from mirrors.models import MirrorUrl
def iso_overview(request):
isos = Iso.objects.all().order_by('-pk')
successes = dict(Iso.objects.values_list('pk').filter(
failures = dict(Iso.objects.values_list('pk').filter(
for iso in isos:
iso.successes = successes.get(, 0)
iso.failures = failures.get(, 0)
# only show "useful" rows, currently active ISOs or those with results
isos = [iso for iso in isos if is True or iso.successes > 0 or iso.failures > 0]
context = {
'isos': isos
return render(request, 'releng/iso_overview.html', context)
class ReleaseListView(ListView):
model = Release
......@@ -135,9 +135,6 @@
# URL to fetch a current list of available ISOs
# URL for SVN access for fetching commit messages (note absence of packages or
# community bit on the end, repo.svn_root is appended)
SVN_BASE_URL = 'svn://'
{% extends "base.html" %}
{% load static from staticfiles %}
{% block content %}
<div class="box">
<h2>Failures and Successes for Testing ISOs</h2>
<p>This is an overview showing all current or tested release engineering
produced ISOs. Past but now unavailable ISOs are ommitted if there were
never any testing results submitted. To help improve ISO quality, you are
encouraged to <a href="{% url 'releng-test-submit' %}">give feedback</a>
if you have tested and used any ISOs. Both successful and failed results
are encouraged and welcome.</p>
<p><a href="{% url 'releng-test-overview' %}">Go back to testing results</a></p>
<table id="releng-result" class="results">
<th>Currently Available</th>
<th># Successes</th>
<th># Failures</th>
{% for iso in isos %}
<a href="{{ iso.get_absolute_url }}">{{ }}</a>
<td>{{|yesno|capfirst }}</td>
<td>{{ iso.successes }}</td>
<td>{{ iso.failures }}</td>
{% endfor %}
{% endblock %}
{% block script_block %}
{% load cdn %}{% jquery %}{% jquery_tablesorter %}
<script type="text/javascript" src="{% static "archweb.js" %}"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".results:not(:has(tbody tr.empty))").tablesorter({widgets: ['zebra']});
{% endblock %}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment