Fix crash on donate page
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from flask import Blueprint, render_template
|
||||
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
|
||||
|
||||
@@ -13,7 +13,7 @@ def donate():
|
||||
if current_user.is_authenticated:
|
||||
reviewed_packages = Package.query.filter(
|
||||
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)))
|
||||
).order_by(db.asc(Package.title)).all()
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}
|
||||
{% block title -%}
|
||||
{{ _("Support packages") }}
|
||||
{% endblock %}
|
||||
{%- endblock %}
|
||||
|
||||
{% macro authorlink(author) %}
|
||||
<a href="{{ url_for('users.profile', username=author.username) }}">
|
||||
|
||||
Reference in New Issue
Block a user