search_fields = ('name', 'description', )
ordering = ('name', )
+class StackBuilderAppAdmin(admin.ModelAdmin):
+ list_display = ('textid', 'name', 'platform', 'version', )
+ filter_horizontal = ('dependencies', )
+
admin.site.register(Mirror, MirrorAdmin)
admin.site.register(Category)
admin.site.register(LicenceType)
admin.site.register(Product, ProductAdmin)
-
+admin.site.register(StackBuilderApp, StackBuilderAppAdmin)
class Meta:
ordering = ('name',)
+
+class StackBuilderApp(models.Model):
+ textid = models.CharField(max_length=100, null=False, blank=False)
+ version = models.CharField(max_length=20, null=False, blank=False)
+ platform = models.CharField(max_length=20, null=False, blank=False,
+ choices= (('windows', 'Windows'), ('osx', 'Mac OS X'),
+ ('linux', 'Linux (32-bit)'), ('linux-x64', 'Linux (64-bit)'))
+ )
+ name = models.CharField(max_length=500, null=False, blank=False)
+ active = models.BooleanField(null=False, blank=False, default=True)
+ description = models.TextField(null=False, blank=False)
+ category = models.CharField(max_length=100, null=False, blank=False)
+ pgversion = models.CharField(max_length=5, null=False, blank=True)
+ edbversion = models.CharField(max_length=5, null=False, blank=True)
+ format = models.CharField(max_length=5, null=False, blank=False,
+ choices = (('bin', 'Linux .bin'), ('app', 'Mac .app'),
+ ('pkg', 'Mac .pkg'), ('mpkg', 'Mac .mpkg'),
+ ('exe', 'Windows .exe'), ('msi', 'Windows .msi'))
+ )
+ installoptions = models.CharField(max_length=500, null=False, blank=True)
+ upgradeoptions = models.CharField(max_length=500, null=False, blank=True)
+ checksum = models.CharField(max_length=32, null=False, blank=False)
+ mirrorpath = models.CharField(max_length=500, null=False, blank=True)
+ alturl = models.URLField(max_length=500, null=False, blank=True)
+ dependencies = models.ManyToManyField("self", blank=True)
+ versionkey = models.CharField(max_length=500, null=False, blank=False)
+
+ def __unicode__(self):
+ return "%s %s %s" % (self.textid, self.version, self.platform)
+
+ class Meta:
+ unique_together = ('textid', 'version', 'platform', )
+ ordering = ('textid', 'name', 'platform', )
+
def productform(request, itemid):
return simple_form(Product, itemid, request, ProductForm)
+#######
+# Stackbuilder
+#######
+def applications_v2_xml(request):
+ all_apps = StackBuilderApp.objects.select_related().filter(active=True)
+
+ resp = HttpResponse(mimetype='text/xml')
+ x = PgXmlHelper(resp, skipempty=True)
+ x.startDocument()
+ x.startElement('applications', {})
+ for a in all_apps:
+ x.startElement('application', {})
+ x.add_xml_element('id', a.textid)
+ x.add_xml_element('platform', a.platform)
+ x.add_xml_element('version', a.version)
+ x.add_xml_element('name', a.name)
+ x.add_xml_element('description', a.description)
+ x.add_xml_element('category', a.category)
+ x.add_xml_element('pgversion', a.pgversion)
+ x.add_xml_element('edbversion', a.edbversion)
+ x.add_xml_element('format', a.format)
+ x.add_xml_element('installoptions', a.installoptions)
+ x.add_xml_element('upgradeoptions', a.upgradeoptions)
+ x.add_xml_element('checksum', a.checksum)
+ x.add_xml_element('mirrorpath', a.mirrorpath)
+ x.add_xml_element('alturl', a.alturl)
+ x.add_xml_element('versionkey', a.versionkey)
+ for dep in a.dependencies.all():
+ x.add_xml_element('dependency', dep.textid)
+ x.endElement('application')
+ x.endElement('applications')
+ x.endDocument()
+ return resp
+
(r'^redir/(\d+)/([hf])/([a-zA-Z0-9/\._-]+)$', 'downloads.views.mirror_redirect'),
(r'^redir$', 'downloads.views.mirror_redirect_old'),
(r'^mirrors.xml$', 'downloads.views.mirrors_xml'),
+ (r'^applications-v2.xml$', 'downloads.views.applications_v2_xml'),
(r'^docs/(current|\d\.\d)/(static|interactive)/(.*).html$', 'docs.views.docpage'),
(r'^docs/(current|\d\.\d)/(static|interactive)/$', 'docs.views.docsrootpage'),