DEV Community

Jeff Triplett (he/him) for Django News

Posted on • Originally published at django-news.com on

Issue 34 - Django Developers Survey 2020

News

Django Developers Community Survey 2020

Please take a few minutes to complete the 2020 survey and help guide the future development of Django.


Abigail Dogbe Awarded the PSF Community Service Award for Q1 2020

From Django Girls workshop mentee in 2017 to lead organizer of PyLadies Ghana and co-organizer of PyCon Africa 2019, Abigail received the PSF Community Service Award for Q1 2020.


Articles

How to Use Django's Parallel Testing on macOS With Python 3.8+ by Adam Johnson

Speed up parallel testing via this excerpt from Adam Johnson's book Speed Up Your Django Tests.


Is Django too slow?

A look at benchmarks and concurrency in Django vs competing web frameworks.


Docker & Django local development: a minimal, step-by-step guide

A beginner-friendly guide to Docker and Django local development.


A Deep Dive into PostGIS Nearest Neighbor Search

PostGIS adds geographic object support to PostgreSQL and is used in the GeoDjango module.


XSS Exploitation in Django Applications

An overview of various exploits that can work against the Django templating engine in a modern web application.


Writing Models in Django

A nice beginner's intro to creating a model and a superuser.


Tutorials

How to manage logs with Django, Gunicorn and NGINX

A guide to configuring logging for Django, NGINX, and Gunicorn.


Creating A To-Do List App With Django, DRF, Alpine.Js, Axios, and TailwindCSS

A step-by-step guide to a basic Todo app using Django, Django Rest Framework, Alpine.js, and Axios.


Fetching Data with AJAX and Django

Use fetch to make AJAX GET and POST requests in Django.


Sponsored Link

Speed Up Your Django Tests

Are you bored of waiting for "manage.py test" to finish? Read this book while you wait! It has many tips and tricks that apply to all projects, big and small, and it covers both Django's test framework and pytest.


Projects

thibaudcolas/curlylint

If you have been looking for a Django HTML template linter, then checkout out Curlylint. It's experimental and very promising.

GitHub logo thibaudcolas / curlylint

Experimental HTML templates linting for Jinja, Nunjucks, Django templates, Twig, Liquid

curlylint

PyPI PyPI downloads Build status Coverage Status Total alerts

{{ 🎀}} Experimental HTML templates linting for Jinja, Nunjucks, Django templates, Twig, Liquid Forked from jinjalint.

Features

Curlylint is an HTML linter for “curly braces” templates, and their HTML. It focuses on rules to check for common accessibility issues.

Screenshot of the curlylint CLI, with an example invocation raising a parsing issue and a rule error

On the roadmap:

  • More checks for common accessibility issues in HTML.
  • Checks for common security issues – for example rel="noopener noreferrer", or known sources of XSS vulnerabilities.
  • More ideas welcome!

Usage

Curlylint is available on PyPI, grab it and you can start linting:

# Assuming you’re using Python 3.6+,
pip install curlylint
# Now time to lint those templates!
curlylint template-directory/
Enter fullscreen mode Exit fullscreen mode

Have a look at our documentation to make the most of it:

Contributing

See anything you like in here? Anything missing? We welcome all support, whether on bug reports, feature requests…


incuna/django-pgcrypto-fields

Transparent field-level encryption for Django using the pgcrypto PostgreSQL extension.

GitHub logo incuna / django-pgcrypto-fields

Transparent field level encryption for Django using the pgcrypto postgresql extension.

django-pgcrypto-fields

Latest Release Python Versions Build Status Requirements Status Updates Coverage Status

django-pgcrypto-fields is a Django extension which relies upon pgcrypto to encrypt and decrypt data for fields.

Requirements

  • postgres with pgcrypto
  • Supports Django 2.2.x, 3.0.x, 3.1.x and 3.2.x
  • Compatible with Python 3 only

Last version of this library that supports Django 1.8.x, 1.9.x, 1.10.x was django-pgcrypto-fields 2.2.0.

Last version of this library that supports Django 2.0.x and 2.1.x was was django-pgcrypto-fields 2.5.2.

Installation

Install package

pip install django-pgcrypto-fields
Enter fullscreen mode Exit fullscreen mode

Django settings

Our library support different crypto keys for multiple databases by defining the keys in your DATABASES settings.

In settings.py:

import os
BASEDIR = os.path.dirname(os.path.dirname(__file__))
PUBLIC_PGP_KEY_PATH = os.path.abspath(os.path.join(BASEDIR, 'public.key'))
PRIVATE_PGP_KEY_PATH = os.path.abspath(os.path.join(BASEDIR, 'private.key'))
# Used by PGPPublicKeyField used by
Enter fullscreen mode Exit fullscreen mode

percipient/django-querysetsequence

The QuerySetSequence wrapper helps to deal with disparate QuerySet classes, while treating them as a single QuerySet.

GitHub logo clokep / django-querysetsequence

Chain multiple (disparate) QuerySets in Django

Django QuerySetSequence

Documentation Status

django-querysetsequence adds helpers for treating multiple disparate QuerySet obejcts as a single QuerySet. This is useful for passing into APIs that only accepted a single QuerySet.

The QuerySetSequence wrapper is used to combine multiple QuerySet instances.

Overview

QuerySetSequence aims to provide the same behavior as Django's QuerySets but applied across multiple QuerySet instances.

Supported features:

  • Methods that take a list of fields (e.g. filter(), exclude() get(), order_by()) must use fields that are common across all sub-QuerySets.
  • Relationships across related models work (e.g. 'foo__bar', 'foo', or 'foo_id'). syntax).
  • The sub-QuerySets are evaluated as late as possible (e.g. during iteration, slicing, pickling, repr()/len()/list()/bool() calls).
  • Public QuerySet API methods that are untested/unimplemented raise NotImplementedError.

Getting Started

Install the package using pip.

pip install --upgrade django-querysetsequence
Enter fullscreen mode Exit fullscreen mode

Basic Usage

# Import QuerySetSequence
from
Enter fullscreen mode Exit fullscreen mode

tonybaloney/django-xss-fuzzer

An XSS vulnerability fuzz tester for Django views.

GitHub logo tonybaloney / django-xss-fuzzer

An XSS fuzzer for Django

Django XSS Fuzzer

An XSS vulnerability fuzz tester for Django views.

This tester will inject XSS patterns into the context data for a template before it is rendered, including:

  • Simple strings
  • Attributes of Django ORM objects in QuerySets

The goal of this tool is to quickly find any XSS vulnerabilities in Django templates.

Any successful injections will write a message to the browser JavaScript console.

Installation

Install via pip

$ pip install django-xss-fuzzer
Enter fullscreen mode Exit fullscreen mode

Add ViewFuzzerMiddleware to your middleware list for a test environment.

MIDDLEWARE = [
    'django_xss_fuzzer.ViewFuzzerMiddleware'
]
Enter fullscreen mode Exit fullscreen mode

Do not deploy this to a production server!

Configuration

Configure the middleware via the Django global settings.

  • XSS_PATTERN : An XSS patterns to try. See XSS Cheatsheet for inspiration.
  • XSS_INJECT_KWARGS (Default False) : A switch to disable injecting XSS view function keyword arguments
  • XSS_INJECT_CONTEXT_DATA (Default True) : A switch to disable injecting XSS into class data

Brobin/django-seed

Seed your Django database with fake data.

GitHub logo Brobin / django-seed

🌱 Seed your Django database with fake data

Django Seed


Django-seed uses the faker library to generate test data for your Django models. This has been "hard-forked" from django_faker in order to support newer versions of Python and Django

Django-seed allows you to write code to generate models, and seed your database with one simple manage.py command!


Python 3.x pypi Actions Build coverage MIT License downloads



Installation

To install django-seed, use pip:

pip install django-seed

Or to install from source:

python setup.py install

Configuration

Add it to your installed apps in settings.py:

INSTALLED_APPS = (
    'django_seed',
)

Usage

Note: When seeding models with Foreign Keys, you need to make sure that those models are seeded first. For example, if a model in app A has a foreign key to a model in app B, you must seed app B first.

Using with command

With django-seed, you can seed your database with test data from…

Top comments (0)