Пример #1
0
def _get_sorted_regform_items(regform, item_ids):
    """Return the form items ordered by their position in the registration form."""

    return (RegistrationFormItem.find(
        ~RegistrationFormItem.is_deleted,
        RegistrationFormItem.id.in_(item_ids)).with_parent(regform).join(
            RegistrationFormItem.parent, aliased=True).filter(
                ~RegistrationFormItem.is_deleted)  # parent deleted
            .order_by(RegistrationFormItem.position)  # parent position
            .reset_joinpoint().order_by(
                RegistrationFormItem.position)  # item position
            .all())
Пример #2
0
def _get_sorted_regform_items(regform, item_ids):
    """Return the form items ordered by their position in the registration form."""

    return (
        RegistrationFormItem.find(~RegistrationFormItem.is_deleted, RegistrationFormItem.id.in_(item_ids))
        .with_parent(regform)
        .join(RegistrationFormItem.parent, aliased=True)
        .filter(~RegistrationFormItem.is_deleted)  # parent deleted
        .order_by(RegistrationFormItem.position)  # parent position
        .reset_joinpoint()
        .order_by(RegistrationFormItem.position)  # item position
        .all()
    )