Skip to content

nitiinkk/django

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Install and Setup Django

Urls & Views

req-res-cycle

Dynamic Path segment & Captured Values

  • Dynamic Path segment: So these act as keyword arguments, which Django will use to forward the captured values for these dynamic parameters to the view function that is being executed.
  • And in there, we could now check with the IF statement, for example, if month is equal to January.

Path Converters

<int:month> can be used to call different view based on the type of value passed

Templates & Static Files

Adding and Registering Template

  • In settings.py, APP_DIRS = True, so if we register our app officialy in settings.py , it would look for templates folder in our app.
  • Under INSTALLED_APPS, add the appName from apps.py
  • from django.template.loader import render_to_string
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

template language and variable interpolation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published