Module-2,3.pptx gg yyfhjhx yykklkbb gb gh

SudeepNM 13 views 31 slides Jun 26, 2024
Slide 1
Slide 1 of 31
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31

About This Presentation

Xfh. Gjknb


Slide Content

Dept. of AIML, JNNCE Full Stack Development with Django Recap: Dynamic URLs More programs with views and urls Django Template System Separating HTML and CSS out Django Template Filters Template Inheritance

Dept. of AIML, JNNCE Full Stack Development with Django Agenda: Using static Django models ORM and models CRUD operations MySQL Admin Interfaces

Dept. of AIML, JNNCE Full Stack Development with Django STATIC_URL = '/static/' STATICFILES_DIRS = [ os . path . join ( BASE_DIR , ‘ap2/static' )] Changes in settings.py <link rel = "stylesheet" href = "{% static 's.css' %}" /> Linking style sheets Use of static

Dept. of AIML, JNNCE Full Stack Development with Django Develop a Django app to produce following web page

Dept. of AIML, JNNCE Full Stack Development with Django Develop a Django app to produce following web page

Dept. of AIML, JNNCE Full Stack Development with Django

Dept. of AIML, JNNCE Full Stack Development with Django

Dept. of AIML, JNNCE Many complex Web sites provide some combination of query and actions. Django is well suited for making database-driven Web sites, as it comes with easy yet powerful ways of performing database queries using python. Full Stack Development with Django

Dept. of AIML, JNNCE Dumb way of database interaction Full Stack Development with Django

Dept. of AIML, JNNCE Hardcoding of db connection parameters Boilerplate code exists Specific to MySQL. Switching of DBMS needs changes everywhere. Problems: Solution – Use Django DB Layer Full Stack Development with Django

Dept. of AIML, JNNCE Configuring the database Full Stack Development with Django

Dept. of AIML, JNNCE Full Stack Development with Django

Dept. of AIML, JNNCE Full Stack Development with Django

Dept. of AIML, JNNCE Full Stack Development with Django An object-relational mapper (ORM) is a code library that automates the transfer of data stored in relational database tables into objects that are more commonly used in application code.

Dept. of AIML, JNNCE Django ORM vs SQL Python ORM is easier to express No need of 2 different languages High-level metadata possible in Python. SQL inconsistent across database platforms. Full Stack Development with Django

Dept. of AIML, JNNCE Django Model Fields Full Stack Development with Django

Dept. of AIML, JNNCE Full Stack Development with Django

Dept. of AIML, JNNCE Django Model Relationship Fields Full Stack Development with Django

Dept. of AIML, JNNCE Django Model Field options Full Stack Development with Django

Dept. of AIML, JNNCE Full Stack Development with Django

Dept. of AIML, JNNCE Full Stack Development with Django Adding objects modelobject.save () Retrieving objects modelobject.objects.all () QuerySet with all records modelobject.objects.filter (filter condition) Query Set with filtered records modelobject.objects.get (id condition) Get specific record

Dept. of AIML, JNNCE Modifying object First get the object with a= modelobject.objects.get (id condition) Then call, a.save () Deleting objects First get the object with a= modelobject.objects.get (id condition) Then call, a.delete () Full Stack Development with Django

Dept. of AIML, JNNCE Full Stack Development with Django WAMP Server https://sourceforge.net/projects/wampserver/files/latest/download https://wampserver.aviatechno.net/ Use phpmyadmin Create database

Dept. of AIML, JNNCE Full Stack Development with Django Install mysqlclient : pip install mysqlclient Changes in settings.py DATABASES = {     'default' : {         'ENGINE' : ' django.db.backends.mysql ' ,         'NAME' : ‘ onlinemeet ' ,         'HOST' : 'localhost' ,         'PORT' : 3306 ,         ' USER' : 'root ' ,         'PASSWORD' : ''     } } Then fill code in models.py using ORM

Dept. of AIML, JNNCE python manage.py makemigrations ap3 python manage.py migrate python manage.py sqlmigrate ap3 0001 python manage.py showmigrations Perform Migrations Demonstrate all CRUD operations for an online meeting application Full Stack Development with Django

Dept. of AIML, JNNCE Develop a Django app that performs student registration to a course. It should also display list of students registered for any selected course. Create students and course as models with enrolment as ManyToMany field. Full Stack Development with Django

Dept. of AIML, JNNCE Full Stack Development with Django Cross Site Request Forgery (CSRF)

Dept. of AIML, JNNCE Full Stack Development with Django

Dept. of AIML, JNNCE Need of Django Admin Interface Automatically build CRUD for models Lot of repetitive tasks is avoided Can be customized It is an authentication based dashboard which restricts to privileged administrators Has powerful features of search and filter Full Stack Development with Django

Dept. of AIML, JNNCE Full Stack Development with Django Create superuser account to access Admin python manage.py createsuperuser Register the models in admin.py admin.site.register ( modelname )

Dept. of AIML, JNNCE For student and course models created in Lab experiment for Module2, register admin interfaces, perform migrations and illustrate data entry through admin forms. Full Stack Development with Django
Tags