diff --git a/app/utils.py b/app/utils.py index e2c78dcaf27c984fb54240a11bc1a9ab1bde50b5..dd9fbec460143392c76249304641b50f4e151d30 100644 --- a/app/utils.py +++ b/app/utils.py @@ -130,7 +130,7 @@ def get_model_choices(model, allow_none=False, attr='name', query=None): if allow_none: choices = [(None, '')] if query is None: - query = model.query + query = model.query.order_by(getattr(model, attr)) choices.extend([(str(instance.id), getattr(instance, attr)) for instance in query.all()]) return choices