mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 22:12:24 +01:00
Fix crash on donate page
This commit is contained in:
parent
b1570d4632
commit
4c66b25e7c
@ -1,6 +1,6 @@
|
|||||||
from flask import Blueprint, render_template
|
from flask import Blueprint, render_template
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
from sqlalchemy import or_
|
from sqlalchemy import or_, and_
|
||||||
|
|
||||||
from app.models import User, Package, PackageState, db, License, PackageReview
|
from app.models import User, Package, PackageState, db, License, PackageReview
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ def donate():
|
|||||||
if current_user.is_authenticated:
|
if current_user.is_authenticated:
|
||||||
reviewed_packages = Package.query.filter(
|
reviewed_packages = Package.query.filter(
|
||||||
Package.state == PackageState.APPROVED,
|
Package.state == PackageState.APPROVED,
|
||||||
Package.reviews.any(PackageReview.author_id == current_user.id, PackageReview.rating >= 3),
|
Package.reviews.any(and_(PackageReview.author_id == current_user.id, PackageReview.rating >= 3)),
|
||||||
or_(Package.donate_url.isnot(None), Package.author.has(User.donate_url.isnot(None)))
|
or_(Package.donate_url.isnot(None), Package.author.has(User.donate_url.isnot(None)))
|
||||||
).order_by(db.asc(Package.title)).all()
|
).order_by(db.asc(Package.title)).all()
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title -%}
|
||||||
{{ _("Support packages") }}
|
{{ _("Support packages") }}
|
||||||
{% endblock %}
|
{%- endblock %}
|
||||||
|
|
||||||
{% macro authorlink(author) %}
|
{% macro authorlink(author) %}
|
||||||
<a href="{{ url_for('users.profile', username=author.username) }}">
|
<a href="{{ url_for('users.profile', username=author.username) }}">
|
||||||
|
Loading…
Reference in New Issue
Block a user