Django Vs ___________ ?
- MVC: Asp.net MVC
- Django create forms in predefined form layout and need tweak to modify
- Routing is done by controller in asp.net in Django do using expression
>>>django-admin startproject app-name folder-name
>>>django-admin startapp app theapp // theapp is name of folder
\\Add app created in settings.py
What is Model : MVC controller Diagram ?
- Data : regarding data as per projects
- Model : Class for project , prevent sql injection attacks if using models
ORM:. Object relational mapping
- - Converts queries into SQL
- - Converts results into objects
Implementation of ORM
- - Hibernate in Java
- - Entity Framework in LINQ
- - Django
>> Save , Delete & Update queries are managed by
Django Framework contained in (models.Model)
>> Properties: size,datatype,Nullability
-
Syntax property_name=models.Type(parameters)
-
Eg name=models.IntegerField(null/default/blank/max_length)
Primary Key is added automatically else :
Foreign Key Syntax
Artist=models.ForiegnKey(Artist)
// Automatically map columns to
object
- Use (name_name instead of nameNAme ) for models to help out in Autogenerated forms
For field options in Django
: https://docs.djangoproject.com/en/1.10/ref/models/fields/
What database Django Support
?
- - SQLite (default in settings.py)
- - MySQL
- - Microsoft SQL Server
How to create Database
?
- - Makemigrations : create package and send to database
- - Sqlmigrate : display sql statement done by migrate
- - Migrate: take the package and create database
Command for Migration
-
python manage.py makemigration --name migration_name app
-
python manage.py showmigrations app [to show all migrations done yet ]
-
python manage.py sqlmigrate app 0001_initial
[to sql command generated ]
-
python manage.py migrate
-
python manage.py app migrate app 0001_initial
Thanks For Sharing The Information The Information Shared Is Very Valuable Please Keep Updating Us
ReplyDeleteCloudi5 (Web Design Company in Coimbatore)