We're using Django 1.4's new wizard to create, well, a wizard. We have a wizard where, a few steps into it, the user has to select a row from a listview/datagrid/table. We use Django-tables2 to show this data.
The problem is that django's wizard has a single fixed URL, and uses a hidden form field that tells the wizard at what step it is. So all forms submit via POST back to the very same URL, and Django's wizard figures out from which page the user comes, stores the submitted data and based on the hidden form field, figures out where to go next.
Django-tables2 is an HTML grid that supports paging and sorting through a set of data. However, it does so using http GET, passing some querystring variables to indicate what column to sort and/or what "page" of data to show.
As soon as we use sorting or paging in a tables2 grid inside a Django wizard, the GET will call the same URL, because it is a GET, the Django wizard will not receive the hidden form values it expects that regulates navigation, and it will happily show the first page of the wizard by default.
I'm wondering if anyone has experience with this and knows of a solution to keep both the Django Wizard as well as the Tables2 functional.
Thanks in advance,
Erik
Related
I am trying to build a conversational form with Django.
It will be used in landing page. The form questions will be loaded one by one as user answers them. And there will be some greeting and "human-way" responses to user input (such as "wow! you did a good choice!" after user selects one of the choices from form). The experience and look of the app will be like a real-time chat but user can only select one of the choices from form or upload a file/image.
1. Which technology is better to use for it? I am planning to do it with Fetch.
2. Since I want it to work without page reloading, how do I need to load Django forms through Fetch? Do I need to pass elements of it with JSON and construct it in client-side or can I just pass it as an html with {{form.as_p}} and display it in HTML?
Does these options make difference in matter of security?
I do not know anything about Fetch, but anyway I think it must be constructed clientside, but at first I would simply display the form in a template to get the ids of its fields and then use it in clientside code.
What about security - you'll need to pass the csrf token via your form.
New to Django here. I have a link to a form in DJango. I use the CreateView to have the user enter the initial information. It all works great and the data is accurately saved to the database. My issue is this: I would like that same link to open the form (it's a one-to-one relationship) with the filled data so the user can see what they have previously entered and correct, edit or update as needed. The form currfently opens as a blank form so if the user has entered that information previously they are unable to see it. I cave researched get_or_create and update_or_create as well as a number of other topics, but can't seem to figure this out. This needs to be a user-friendly experience so multiple entires or clicking multiple buttons to access the data is not an option. How best can I implement this?
#Don you can checkout django formsets, I think this will help in this situation. And you can use a single FormView for all your needs by overriding its methods.
Have you looked at Django Sessions. It’s a simple way of saving session data and passing the data to future requests. https://docs.djangoproject.com/en/3.0/topics/http/sessions/. I. In your form view you cloud save the session data you want to pass to your next form. In your next form, you could use the session data as default values. I’ve done something similar in the past.
I'm using Django to set up a website, where users can add spatial informations associated with ecological datasets. I'm using leafletjs to display pins on the map, where datasets have been sampled.
The solution I have now, is to have users write lat/lon as fields. On the other hand, there is an example on the leaflet website where clicking on the map will display the coordinates, and that is much more user friendly. So I'd like to have this + a javascript to fill the lat/lon position, in the form rendered by Django.
Is there any chance I can put that in a Django form, or must I write the form in HTML?
In this case, I would use an AJAX form to post entries in the back end, and upon submission recall the entries and write it out as JSON. Django has native functionality for all of this.
Here is a recent SO example: How to submit form without refreshing page using Django, Ajax, jQuery?
When one has added a WFFM form to a Sitecore Item, you can go to the Presentation Details and click on Form. There you'll see an option called ReadQueryString - Reads initial values from the url query string.
My form has a few fields, one of which being Email. I tried adding ?Email=test to the URL of the page that hosts this form, but the value is not being picked up. Am I correctly understanding the intended purpose of this option? Am I using it correctly?
Sitecore version 6.5; Web Forms for Marketers version 2.3
You understood the purpose correctly, when that option is checked the form's initial values are read from the querystring.
I have used this in my project and it works fine.
Make sure that you are using the field's item name in the querystring, not the displayname or title.
Also double check if you published the item after checking the ReadQueryString option.
i have an add_form under my django app. i want to add a feature this form which is saving form automatically after user starts to type.
like in gmail , or blogger.
what are the steps i should follow? which way or plugin? and how to use them?
any knowlenge can help me.thank you.
There's two useful jquery plugins to get you started
https://github.com/BenGriffiths/jquery-save-as-you-type which saves what you type locally to a cookie client-side. Using this plugin is simpler and you will only need to actually save into your django backend when the user hits your form's "save" button.
and
https://github.com/nervetattoo/jquery-autosave which requires that you set up an intermediary model (perhaps a Draft model) in django to keep track of updates along the way. And when the user finally hits save, a final copy of the data is then saved into the actual model.