I have an object in python views.py
that references the events
database table. When there is data, it displays the data in my html template, however, when there is no data, I cannot figure out the {% if %}
function that would display the message "No data found."
I have tried Tadeck's post, but the is defined
always seems to evaluate to true even if there is no data to display. Thank you for your help.
{% if events is defined %}
value of variable: {{ events }}
{% else %}
variable is not defined
{% endif %}
views.py
events = db.session.query(Eventdetails, Buyers).\
join(Buyers).\
filter(Eventdetails.events_id == event_id)
return render_template(
self.template_file, events=events, the_event=the_event,
event_id=event_id
)