Jam.py documentation

Tutorial. Part 2. File and image fields

In this part we will demonstrate how to work with files and images in Jam.py.

Adding Image field

Let’s select the “Customers” catalog, Double-click it to open the Item Editor Dialog and add an image field “Photo”:

image_field.png

Now refresh the project page, click the Customers menu item and open the edit form.

image_project1.png

Double-click the image in the editing form to select an image from the Open File dialog box.

select_image.png image_project2.png

Note

To clear an image, hold down the Ctrl key and double-click the image.

Let’s open the Field Editor Dialog in Application Builder and set View width to 120 and Edit width to 314 on the Interface tab.

image_field2.png

Note

You can set the image placehodler by double-clicking on it.

In the View Form Dialog we set Row lines to 4 and the width of the “Photo” field to 120.

image_view_form.png

Now on the project page we will have:

image_edit.png

Adding file field

Now we add a field that will store an appendix file to the “Contacts” journal.

file_field.png

This field will be displayed in the editing form as follows:

appendix_edit.png

The field input have three buttons on the right - to upload, to download and to open a file.

Let’s open the Field Editor Dialog in Application Builder and uncheck the Download btn check box and set Accept attribute to ‘.pdf’.

appendix_interface.png

Let’s refresh the project page, open the “Contacts” edit form and upload a file by clicking the upload button:

appendix_select.png

Now we can open a file in the browser by clicking on the open button.

appendix_field2.png appendix_pdf_open.png

Note

Files and images are stored in the static/files folder on the server.

You can limit the size of files that can be uploaded to the server by setting Max content length attribute in the project parameters.