davidhamann/python-fmrest

How to display results of find dynamically into a template?

Closed this issue · 6 comments

How to display results of find dynamically into a template?

Can you elaborate where you are stuck / what you are trying to do with a small sample code? Usually, once you have a Foundset you can just iterate over it and then extract the fields from the records in the set.

Hi, having trouble here. I'm using Django Framework.

I can successfully display on my terminal the response of the API. I'm just having a problem with how to display it dynamically on my template.

My plan is upon finding a field, it will show the result without having reloading the page. If there is a chance that you have some tips on this.

Here is my code.

Screenshot at Jan 17 10-34-21

Screenshot at Jan 17 10-34-58

Screenshot at Jan 17 10-35-35

Sorry, cannot help with Django as I'm not using it.

Just a few ideas: you're using record.values in the template vs record.values() in the print. Other than that I would try to not pass the whole list to the template but maybe try to give the template only a specific field (like record.RefNo) or "stringify" the list first (like json.dumps()) and see if that makes a difference.

PS.: I removed your first screenshot as it contained a "real-looking" user, password and server address – just in case.

In case it was real, I would recommend to change it asap :-)

Oh shoot, thanks already replaced it. Okay, I resolved it already. But how do you handle errors in API response from filemaker?

I got NameError: name 'NoMatch' is not defined or NameError: name 'FileMakerError' is not defined