diff --git a/app/models.py b/app/models.py index 9aab1b55..4b16b046 100644 --- a/app/models.py +++ b/app/models.py @@ -147,6 +147,18 @@ class Package(db.Model): type=self.type.toName(), author=self.author.username, name=self.name) + def getDownloadURL(self): + return url_for("package_download_page", + type=self.type.toName(), + author=self.author.username, name=self.name) + + def getDownloadRelease(self): + for rel in self.releases: + if rel.approved: + return rel + + return None + def checkPerm(self, user, perm): if not user.is_authenticated: return False diff --git a/app/templates/packages/view.html b/app/templates/packages/view.html index d0d13e11..4ccb4d75 100644 --- a/app/templates/packages/view.html +++ b/app/templates/packages/view.html @@ -39,6 +39,7 @@