key down not working after inserting new form and command button to go from one form to other - visual-studio-2017

After inserting a new form and button to go from one form to other (me.hide and from2.show) key.down event is not working .

Related

How to pass context object from a template to a view in django?

In search results page,a list of experts with their name and some other details are displayed.The name and the details are accessed from a context object "expert" that has been passed to search results page.Beside each search result I also generated a "save" button .When the user clicks on the save button,I need to save the individual expert data to a database.How do I send this "expert" context object from the search results page to a view so that I can then save it to the database?
Here is the search result page:
Here is part of the code of the for the search results:
You can see I tried to create a hidden form with a button to send the context object to a view but it's not working.How do I create the button so that when the user clicks "save" button the url sends the context "expert" to a view?
I tried to create a hidden form with a button to send the context object to a view but it's not working

Redirect from bootstrap tab to another Django

I have two tabs in a template.In one tab I can create attendance(tab1) in another tab I can view attendance(tab2) that was created previously.Now when I create a attendance successfully I want to check if the attendance is valid and if valid I want to redirect from tab 1 to tab 2. How can I achieve this in Django?
Here's my template and view snippet
https://gist.github.com/quantum2020/c55adeb3b8c2ee0ac2d99ff46f5699e8
https://gist.github.com/quantum2020/2cb28233608c3a219ff97762e1fd62be

How to create a one parent form having a two child forms within it?

I am trying to achieve this : I want one parent form which have a "submit" button and it should contain the two child forms in which one of the child (here suppose have two child child-1 and child-2 ) child-1 gets added to form dynamically when user click "add child-1". How to achieve this in django forms ?
I think you can create form with hidden fields(child-1) and show them with jQuery after pressing on "add child-1" button.
If your children are of the same origin (ex. a form asking if you have chlidren; you add one child and then another), then you need formsets:
https://docs.djangoproject.com/en/dev/topics/forms/formsets/
If you want a single form to be broken in parts/steps (ex. step 1: fill in your address; step 2: provide information about your company; step 3: etc...), you need a form wizard:
https://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/

Make Django form results editable

I have a form which users fill and all the results are displayed on another page as a table. How can I make the results editable in that page (table)? If you want to edit some row you can press something like an edit button which will make the row change the values from text to their respective widgets as in the form, so you can edit it yourself.
Try django-jeditable which uses jEditable jQuery plugin.

django admin Add custom button + custom form

I want to add a custom button near 'Add model_name'. When i click on the newly created button i should like to show a custom form where I cans elect a model out of a select box. When i click on save I want to save this model and chance some parameters so it's a 'add' but without selecting all options again. I give a clear example:
I have a model names 'Book'. The first time i create a new book entry, i have a form 'add Book' and i have to fill out the form completely. So i have the book with primary key = Book_1_1 But now i want to add a second book, it's the same book as the first 1 BUT the version changed, so i want a new book but i don't want to select all items anymore in the standard 'add Book' form, i want something like i click on create new instance --> i can select 1 book out of a select box with all book objects in it, and when i 'save' this a new instance of the book gets generated. This instance has the following primary key: Book_1_2 for example. I know how to save this, but i don't know how to change the admin site to do this. I need 2 things:
1) add a button 'new instance' near 'Add_model_name'
2) Deliver a form with all model_name objects in a select box and when i click save i want to retrieve an object with which i can modify some things to save it as 'new book'.
Any ideas?
UPDATE I already added the 'new' button, but like i can see at this moment instead of the url = add , i have to create a new url inside the admin like add_instance etc. Does someone have any documentation on this?
Regards,
Hein
Making it way too hard on yourself. Just do this:
class MyModelAdmin(admin.ModelAdmin):
# Other stuff here
save_as = True
Now you can open up your book entry, change whatever is different and hit "Save as new" and it'll create a new book with that info instead of overwriting the other.