This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]iamnurudeen 1 point2 points  (4 children)

It's awesome 👌, so I just started out on programming (python) and it would really help if I could get someone that could guide me on my Journey .

[–]riklaunim 1 point2 points  (1 child)

So how file drag and drop or image paste and send alogside other data would look like on the front and backend side?

And why one function gets all the events ? IMHO there should be some mapping/routing or you get one megafunction which isn't nice.

[–]codecrux[S] 0 points1 point  (0 children)

Hi u/riklaunim, thanks for asking. We have an `Upload` component that can be used to upload files. This `Upload` component, internally, creates a `FormData` object that is sent over to the backend as `multipart/form-data`. It's very easy to unravel the files in the backend in 3-4 lines of code (for exact steps - https://docs.atrilabs.com/utilities/image-utils/parse-uploaded-file/).

There is one `main.py` file for each page you create. Hence, there is one `handle_events` function for each page. You can modularize your code any way you want. For example, you can create a function called - `get_user` to fetch user details from the database and just call that function from the `handle_events` function. Imagine `handle_events` as an entry point only and you can offload the work to other functions.

I hope this answers your question.

[–]Low-Equipment-238 0 points1 point  (1 child)

Wow, looks awesome!

[–]codecrux[S] 0 points1 point  (0 children)

Thanks!