Open barseghyanartur opened 7 years ago
@barseghyanartur so by this are you wanting an example embedding a form or wizard into another view? because i would love if that example existed. if so ill do it.
@jstacoder:
It has been a long time since I wrote this. I'm not sure of what I exactly meant by that. Unfortunately, I haven't applied my good intentions to write/explain as much as possible in this case, so I'm quite unsure of what I could have meant.
However, if you explain what you might need, I might give you a good advice.
i would like to embed the wizard into a view, as well as embed the forms it creates into a view, since they are generated dynamically i am having trouble doing this...
Ah, ok. It's very simple. Now I remember what I meant.
Examples (stripped down) taken from a working custom made fobi setup (made a couple of years ago).
In your sample view:
views.py
from fobi.views import FormWizardView
def embed_form_wizard_view(request, **kwargs):
# Do whatever you want, feed extra params to the wizard. You can even override
# the standard wizard somewhere above, customise it and use it instead of
# FormWizardView.
wizard = FormWizardView.as_view()
return wizard(request)
urls.py
from django.conf.urls import url
from .views import embed_form_wizard_view
urlpatterns = [
url(r'^wizards/(?P<some_argument>[\w_\-]+)/$',
view=embed_form_wizard_view,
name='myproject.embed_form_wizard_view'),
]
after a little digging i realized what i was looking for were the functions in fobi/dynamic.py, assemble_form_class
, assemble_form_wizard_class
, to get the actual form classes i can render inside templates, i think i will provide an example using these functions.
Make an example with embed form/wizard