How to use Model or View in Django

 We'll get some information about Model.Py And Views.py through this post today.

What is model.py?

This file contains the structure of the database for your application. This will be the blueprint of our database design and attribute constraints.  



 
User_code, User_name, Mobile_no, Address, Password they are the Fields of the model. Each field is specified as a class attribute and each attribute maps to a database column. A certain Post contains a title that will be a field knows as "CharField". 

What is views.py?

This file is responsible for whats user look. It contains a code of how your project looks like. It is represented by HTML/CSS and javascript.


We import the HttpResponse from Django.http module, then we define a function called "index". Each views functions is responsible for returning an HttpResponse object


Post a Comment

1 Comments