Fix bugs with edit EditRequests

Fixes #63
This commit is contained in:
rubenwardy
2018-05-25 17:12:34 +01:00
parent 211ed7c6fd
commit 71308d25d5
3 changed files with 17 additions and 5 deletions

View File

@@ -215,6 +215,8 @@ class PackagePropertyKey(enum.Enum):
type = "Type"
license = "License"
tags = "Tags"
harddeps = "Hard Dependencies"
softdeps = "Soft Dependencies"
repo = "Repository"
website = "Website"
issueTracker = "Issue Tracker"
@@ -287,6 +289,17 @@ class Package(db.Model):
requests = db.relationship("EditRequest", backref="package",
lazy="dynamic")
def __init__(self, package=None):
if package is None:
return
self.author_id = package.author_id
self.created_at = package.created_at
self.approved = package.approved
for e in PackagePropertyKey:
setattr(self, e.name, getattr(package, e.name))
def getAsDictionary(self, base_url):
return {
"name": self.name,