You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
I'm new in development and am facing some issue about customisation.
I'm trying to upload file and I want to perform a lot of customisation like remove uuid automatically generated for filename so that the file upload process save the original filename in the db and the upload_folder. I somehow figure out how to do this by overriding pre_add and post_add methods. But the ultimate goal of this is to be able to show a modal dialog for user to confirm if he or she wants to continue upload process of an already existing file (from db) or cancel the whole thing. I know it's possible to have the dialog box because we see it when we want for example to delete a record. It's something similar I want to achieve. After clicking save button for the file to be uploaded, I want to have a similar dialog box in case the Same filename already exist in db.
So far I have override the pre_add method to get the original filename using the function in file manager that helps perform this. In this pre_add method I am also able to fetch the db table and know if a similar file was already upload. But then I'm confused.
From the post add side I used shutil to rename the file in the upload folder.
My big point of confusion is where and how could i make a modal dialog visible when the form is post and the filename already exist in the db.
So I decided to create my own upload form based on upload file model but here again fab can create the form by itself and I can't see where and how could I add maybe some JavaScript to have my modal dialog box showed up.
Going further in docs I saw I could define my own add_template and used extra_args for other elements that must be provided to the template. But here I don't know how to make my way.
Here is what I have done
add_temolate = 'form.html'
extra_args = {'form' : 'add_form'}
But when I run the app I get hidden_tag() missing required positional argument self.
If I go up and comment this part and run the app again I get jinja2 error unboundedfield has no attribute label.
I really don't know what to do. I need guidance on how to achieve my goals.
The text was updated successfully, but these errors were encountered:
Hello!
I'm new in development and am facing some issue about customisation.
I'm trying to upload file and I want to perform a lot of customisation like remove uuid automatically generated for filename so that the file upload process save the original filename in the db and the upload_folder. I somehow figure out how to do this by overriding pre_add and post_add methods. But the ultimate goal of this is to be able to show a modal dialog for user to confirm if he or she wants to continue upload process of an already existing file (from db) or cancel the whole thing. I know it's possible to have the dialog box because we see it when we want for example to delete a record. It's something similar I want to achieve. After clicking save button for the file to be uploaded, I want to have a similar dialog box in case the Same filename already exist in db.
So far I have override the pre_add method to get the original filename using the function in file manager that helps perform this. In this pre_add method I am also able to fetch the db table and know if a similar file was already upload. But then I'm confused.
From the post add side I used shutil to rename the file in the upload folder.
My big point of confusion is where and how could i make a modal dialog visible when the form is post and the filename already exist in the db.
So I decided to create my own upload form based on upload file model but here again fab can create the form by itself and I can't see where and how could I add maybe some JavaScript to have my modal dialog box showed up.
Going further in docs I saw I could define my own add_template and used extra_args for other elements that must be provided to the template. But here I don't know how to make my way.
Here is what I have done
add_temolate = 'form.html'
extra_args = {'form' : 'add_form'}
add_form was define early as MyUPloadFom
In the form.html
I have something like
{% extends 'appbuilder/general/model/add.html' %}
{% block body %}
{{ form.hidden_tag() }}{{ form.name.label }}
{{ form.name() }}
{{ form.description.label }}
{{ form.description(s) }}
{{ form.submit() }}
{% endblock %}But when I run the app I get hidden_tag() missing required positional argument self.
If I go up and comment this part and run the app again I get jinja2 error unboundedfield has no attribute label.
I really don't know what to do. I need guidance on how to achieve my goals.
The text was updated successfully, but these errors were encountered: