mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix(models.package_source): fix primary key constraints
Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
22093c5c38
commit
5142447b7e
3 changed files with 12 additions and 5 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Reference in a new issue