Import Wizard
Style-agnostic import wizard component.
Preview
1Upload
2Map Fields
3Preview
Drag & drop or click to upload
Accepted: .csv
Usage
views.py
python
from djust import LiveView
from djust.decorators import event_handler
from djust.components import ImportWizard
class MyView(LiveView):
template_name = "my_template.html"
def mount(self, request, **kwargs):
self.component = ImportWizard()
@event_handler()
def upload_file(self, value=None, **kwargs):
... # write to self.component; the re-render carries it
@event_handler()
def import_data(self, value=None, **kwargs):
... # write to self.component; the re-render carries itmy_template.html
django
{{ component }}Events this component sends to the view: upload_file, import_data.
Parameters
| Name | Type | Default |
|---|---|---|
| accepted_formats | str | '.csv' |
| model_fields | list | None | None |
| event | str — renames the event; identity is `name` | 'import_data' |
| step | str | 'upload' |
| upload_event | str — renames the event; identity is `name` | 'upload_file' |
| custom_class | str | '' |
| **kwargs | — passed to `Component.__init__`: `name=` identifies the instance in the events it sends, `id=` sets `component.id`, and any other keyword is kept as state | — |
Source & styles
| File | Path | Notes |
|---|---|---|
| module | djust.components.components.import_wizard | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 10 of this component's classes at line 1901, 1902, 1903, 1904, 1906, 1908, 1909, 1910, 2439, 2440. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |