Django for Designers/Basic views: Difference between revisions

Content added Content deleted
imported>Aldeka
imported>Aldeka
Line 16: Line 16:


===M-V-C separation concept===
===M-V-C separation concept===

[[File:mtv-diagram.png|400px]]


When you write a Django app, your code is organized in a fashion reminiscent of a well-known design pattern known as MVC, short for ''model, view, controller''. Django's precise organization methodology is based on ''models'', ''views'', and ''templates''.
When you write a Django app, your code is organized in a fashion reminiscent of a well-known design pattern known as MVC, short for ''model, view, controller''. Django's precise organization methodology is based on ''models'', ''views'', and ''templates''.

[[File:mtv-diagram.png|400px|Django architecture flowchart]]


For Django, a ''model'' represents how the data is stored. This is the part of your app that ties your data to storage in a database. You write Python code, and Django converts it and out of into SQL, the language spoken by databases.
For Django, a ''model'' represents how the data is stored. This is the part of your app that ties your data to storage in a database. You write Python code, and Django converts it and out of into SQL, the language spoken by databases.