Skip to content

python dictionary object to html5 json form generator

Notifications You must be signed in to change notification settings

mehmetkose/dict2form

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dict2form

python dictionary object to html5 json form generator

more information about HTML JSON form submission

installation

pip install dict2form

usage

from dict2form import dict2form
my_dictionary = {'name': 'Mehmet', 'surname': 'Kose'}
form = dict2form(my_dictionary, name="profile", method="post")
print(form)

As we'll see a form like this:

<form enctype='application/json' method="post">
	<input name='profile[name]' value='Mehmet'>
	<input name='profile[surname]' value='Kose'>
	<input type='submit' value='Submit'>
</form>

input hiding

from dict2form import dict2form
my_dictionary = {'name': 'Mehmet', 'surname': 'Kose', 'password':'123456LOL'}
form = dict2form(my_dictionary, name="profile", hide=['password'])

xsrf

form = dict2form(my_dictionary, xsrf="XXXXXXXX")
print(form)
<form enctype='application/json'>
	...
	<input type="hidden" name="_xsrf" value="XXXXXXXX"/>
</form>

defaults

  • name = object
  • hide = []
  • method = GET
  • xsrf = None
  • submit_name = Submit

About

python dictionary object to html5 json form generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages