This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="{% url 'set_language' %}" method="post" class="nav-link"> | |
{% csrf_token %} | |
<input name="next" type="hidden" value="{{ redirect_to }}" /> | |
<select name="language" style="width: auto; color: #d4c270" | |
onchange="this.form.submit()"> | |
{% get_current_language as LANGUAGE_CODE %} | |
{% get_available_languages as LANGUAGES %} | |
{% get_language_info_list for LANGUAGES as languages %} | |
{% for language in languages %} | |
<option value="{{ language.code }}" {% if language.code == LANGUAGE_CODE %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.route("/upload", methods=["GET", "POST"]) | |
def upload_file(): | |
form = FileUploadForm() | |
if form.validate_on_submit(): | |
file = form.document.data | |
file_name = secure_filename(file.filename) | |
save_path = get_user_uploads_folder(current_user) / file_name | |
file.save(save_path) | |
flash("File uploaded successfully", category="success") | |
return redirect(url_for("list_user_files")) |