Wednesday 15 June 2011

Django: How are forms related to models? -


I am a newbie for MVC architecture. Can anyone tell me what the form is, what they do and how they relate to the model. Deeds, which takes care of the tasks related to many common forms according to the documentation forms. What are those tasks? I see that the form is mentioned during registration, is it used only alone? Is the draft model used as a post-field request? If the model is in model / form then can not we have any fields which are not related to the current model?

Conceptually, the handler form to input data data Used to use your HTML to use that data somewhere (in your opinion)

You will find two common uses for the form in Django: your model (data defined by your database) For the purpose of working with or completing any kind of work (like sending an e-mail - where you Ri does not require an associated model).

There are many things to do in this form for both tasks; it is easy to limit modularity, expandable and management (as they can easily be defined, intimate, inherited in Python etc.) Validation (from one of the great things) is important - and it is possible that you are talking about registration. If you are using something like a modelform, then the Django form will be valid with the defined definition in your form class or obtain the verification code. In the case of a modelform, the form will be valid based on the attributes specified in your model fields (i.e., no string is entered in an integer field).

As I mentioned earlier, keeping in mind the two common uses, you should check the related links of the document in this way.

To answer some of your other questions you may not be related to your model in model model - but you have to handle them properly in your view. Not all of your models are available in a form for field input (for exclusion in class meta).

No comments:

Post a Comment