Folders and files Β
Β
Β
Β
Β
Β
Β
Β
Β
Β
View all files
Repository files navigation π Django BOOK: Practical recipes for building fast, robust, and secure web apps using Django 3 and Python
01. Getting Started with Django 3.0
Working with a virtual environment β
Creating a project file structure β
Handling project dependencies with pip β
Configuring settings for development, testing, staging, and production environments β
Defining relative paths in the settings β
Handling sensitive settings β
Including external dependencies in your project β
Setting up STATIC_URL dynamically β
Setting UTF-8 as the default encoding for the MySQL configuration β
Creating the Git ignore file β
Deleting Python-compiled files β
Respecting the import order in Python files β
Creating an app configuration β
Defining overwritable app settings β
Working with Docker containers for Django, Gunicorn, Nginx, and PostgreSQL β
02. Models and Database Structure
Using model mixins β
Creating a model mixin with URL-related methods β
Creating a model mixin to handle creation and modification dates β
Creating a model mixin to take care of meta tags β
Creating a model mixin to handle generic relations β
Handling multilingual fields β
Working with model translation tables β
Avoiding circular dependencies β
Adding database constraints β
Using migrations β
Changing a foreign key to the many-to-many field β
Chapter 3: Forms and Views Demo
In this chapter, we will cover the following topics:
Creating an app with CRUDL functions β
Saving the author of a model instance β
Uploading images β
Creating a form layout with custom templates β
Creating a form layout with django-crispy-forms β
Working with formsets β
Filtering object lists β
Managing paginated lists β
Composing class-based views β
Providing Open Graph and Twitter Card data β
Providing schema.org vocabularies β
Generating PDF documents β
Implementing a multilingual search with Haystack and Whoosh β
Implementing a multilingual search with Elasticsearch DSL β
Chapter 4: Templates and JavaScript Demo
In this chapter, we will cover the following topics:
Arranging the base.html template β
Using Django Sekizai β
Exposing settings in JavaScript β
Using HTML5 data attributes β
Providing responsive images(env)$ python manage.py migrate ideas zero β
Implementing a continuous scrolling β
Opening object details in a modal dialog β
Implementing the Like widget β
Uploading images via Ajax β
Chapter 5: Custom Template Filters and Tags Demo
In this chapter, we will cover the following recipes:
Following conventions for your own template filters and tags β
Creating a template filter to show how many days have passed since a post was published β
Creating a template filter to extract the first media object β
Creating a template filter to humanize URLs β
Creating a template tag to include a template, if it exists β
Creating a template tag to load a QuerySet in a template β
Creating a template tag to parse content as a template β
Creating template tags to modify request query parameters β
Chapter 6: Model Administration Demo
In this chapter, we will cover the following topics:
Customizing columns on the change list page β
Creating sortable inlines β
Creating admin actions β
Developing change list filters β
Changing the app label of a third-party app β
Creating a custom accounts app β
Getting user Gravatars β
Inserting a map into a change form β
You canβt perform that action at this time.