django - How to give initial value in modelform -


How do I provide the initial value for the field in ModelForm? Example:

  class form 1 (forms.Form): title = forms.CharField (initial = "hello")  

what would be equivalent to this ModelForm The basic syntax is something like this:

  class Form2 (djangoforms.ModelForm): class meta: model = some model regions = ('title',)  

What I am trying to do is generate a CRUD. Since I am doing this in an Appenin project, I can not use general ideas. Appengine has provided us the djangoforms.ModelForm which works like the ModelForm of the DEGENGO, but uses APINgin's Datastore.

I need the above functionality "Edit" part.

Normally, you can pass the model object that you want to use for the example keyword ARGU Editing in form: Form2 (example = somemodelobject) , but I do not know if it works on GAE, you can always send the constructor of your form to the initial dictionary, like

  form 2 (initial = {"title": "blahblah"})  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -