Verified Commit 5142447b authored by Kevin Morris's avatar Kevin Morris
Browse files

fix(models.package_source): fix primary key constraints



Signed-off-by: Kevin Morris's avatarKevin Morris <kevr@0cost.org>
parent 22093c5c
......@@ -10,7 +10,10 @@ class PackageSource(Base):
__table__ = schema.PackageSources
__tablename__ = __table__.name
__mapper_args__ = {
"primary_key": [__table__.c.PackageID]
"primary_key": [
__table__.c.PackageID,
__table__.c.Source
]
}
Package = relationship(
......@@ -26,3 +29,6 @@ class PackageSource(Base):
statement="Foreign key PackageID cannot be null.",
orig="PackageSources.PackageID",
params=("NULL"))
if not self.Source:
self.Source = "/dev/null"
......@@ -201,7 +201,8 @@ async def package(request: Request, name: str) -> Response:
context["package"] = pkg
# Package sources.
context["sources"] = pkg.package_sources
context["sources"] = pkg.package_sources.order_by(
models.PackageSource.Source.asc()).all()
# Package dependencies.
dependencies = db.query(models.PackageDependency).join(
......
......@@ -45,14 +45,14 @@
</div>
<div id="pkgfiles" class="listing">
<h3>Sources ({{ sources.count() }})</h3>
<h3>Sources ({{ sources | length }})</h3>
</div>
<div>
<ul id="pkgsrcslist">
{% for source in sources.all() %}
{% for src in sources %}
<li>
<a href="{{ source.Source }}">{{ source.Source }}</a>
<a href="{{ src.Source }}">{{ src.Source }}</a>
</li>
{% endfor %}
</ul>
......
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