I was trying to make a button to search a database of cars using the plate number in a textbox within dates picked by the user where cars were registered, and show them on a repeating panel, I used a suggested method to make it work, but it didn't, I may have typed something incorrectly or misinterpreted the explanation, and I got no data shown in the rows of the repeating panel and no error or warnings so I'm not sure where did I go wrong.
I'm working on anvil using Python, but I'm relatively new to that language.
def button_busq_placayfecha_click(self, **event_args):
"""This method is called when the button is clicked"""
start_date = self.date_picker_2.date
end_date = self.date_picker_3.date
busq_placa = self.search_placa_box
l = [q.greater_than_or_equal_to(start_date), q.less_than_or_equal_to(end_date)]
d = {
'fecha': q.all_of(*l),
'placa': q.ilike(f'%{txt}%'),
}
for row in app_tables.registro.search(
tables.order_by('fecha'),
fecha=q.all_of(
q.greater_than_or_equal_to(start_date),
q.less_than_or_equal_to(end_date)
),
placa=q.ilike(f'%{busq_placa}%')
):
self.repeating_panel_busqueda_fecha.items = app_tables.registro.search(tables.order_by('fecha'), **d):
print(row['placa'], row['fecha'])
row = app_tables.registro.search([...])
self.repeating_panel_busqueda_fecha.items = row
self.repeating_panel_busqueda_fecha.items = app_tables.registro.search(tables.order_by('fecha'), **d):
gives me a Syntax error: bad input, I'm not sure, why.
Here is a link to my project.