What you want is to expose a REST API using the Django REST Framework and have HTTP endpoints (URLs) mapped to functions on your backend (e.g. generate_list_of_sundays()).
Then, on the frontend, the button would submit an HTTP request to the given endpoint (i.e. could be POST, GET and so on).
The frontend can either use a form to submit the information or something like AJAX.
You could also avoid using the REST API approach and have Django views that extract data from the HTTP request and act upon it, but while it might seem easier, this would lead to a poor user experience.
I'm creating webapp and using DRF on the server. I want to start function on server, after event on frontend (for example - button clicked)
Example:

User is typing '2021' in input field on frontend and click the button ,,generate"
The '2021' is transfering to function ,generate_list_of_sundays(year)' on server
The function return list of all sundays in typed year
List is displayed to user on frontend

Of course this is simple example. I want to know how to get this type of communications between frontend and backend.
Django REST Framework - how to start functions on backend after event on frontend