DEV Community

loading...
Django News

Django News #14 - New Django Project governance model, a PyCon US update, Python 3.7.7, and much more!

jefftriplett profile image Jeff Triplett (he/him) Originally published at django-news.com on ・2 min read

News

The Django Project adopts a new governance model

The Django Project is switching from a core team to a Django Technical Board. Find out what this means and how the project will be governed.

Django co-creator and former BDFL, Jacob Kaplan Moss, wrote Django’s new governance model to share his thoughts.


PyCon US 2020 is exploring options to cancel or re-schedule due to COVID-19

The Foundation is currently exploring options to re-schedule or cancel the conference. Any final decision to cancel or reschedule PyCon US will be made early enough to give you time to cancel or defer your travel plans.


Python Insider: Python 3.7.7 is now available

Python 3.7.7 is out!


Articles

About Removing Duplicates in the Database - DjangoTricks

An elegant code snippet for removing duplicates in a database.


9 Django Tips for Working with Databases

Multiple tips for getting more out of Django's ORM.


Django Best Practices - Function-Based Views vs Class-Based Views

An overview of the pros/cons of each approach.


Django's Field Choices Don't Constrain Your Data

An interesting take on Field.choices in Django.


TLDR: Generate Django Secret Key

This TLDR is a quick reminder of how to generate a secret key locally, without going to some website on the internet to generate it for you.

humberto.io


Sponsored Link

Django Styleguide

GitHub logo HackSoftware / Django-Styleguide

Django styleguide used in HackSoft projects

Django Styleguide


Django styleguide used in HackSoft projects.

Expect often updates as we discuss & decide upon different things.

If you want to check an existing project showing most of the styleguide, check the Styleguide-Example

Table of contents:

Overview

In Django, business logic should live in:

  • Model properties (with some exceptions).
  • Model clean method for additional validations (with some exceptions).
  • Services - functions, that take care of writing to the database.
  • Selectors…

From HackSoft, a styleguide for Django projects at scale.


Podcasts

Django Riffs - Views on Django

A look at views, a major component within Django and a primary place where your code will run. Show notes here.


Django Chat - API-First Architecture

A discussion of the multiple ways to architect APIs with Django REST Framework, including focus on authentication, front-end frameworks, and performance.


Projects

ydaniv/django-rest-assured: Instantly test-cover your Django REST Framework based API

GitHub logo ydaniv / django-rest-assured

Instantly test-cover your Django REST Framework based API

django-rest-assured

Build Downloads Latest Version License

Instantly test-cover your Django REST Framework based API.

Django-REST-Assured adds another layer on top of Django REST Framework's APITestCase which allows covering a set of RESTful resource's endpoints with a single class declaration.

This gives both a quick coverage of sanity tests to your API and a more DRY and more friendly platform for writing additional, more comprehensive tests.

As easy as

class CategoryTestCase(ReadWriteRESTAPITestCaseMixin, BaseRESTAPITestCase)
    base_name = 'category'
    factory_class = CategoryFactory
    create_data = {'name': 'comedy'}
    update_data = {'name': 'horror'}

Django-REST-Assured is designed to work with factory_boy for mocking objects to test against. However, you can easily extend the BaseRESTAPITestCase to work directly with Django Models or any other factory.

Main features

  • Class-based declarative API for creating tests.
  • Covers the stack through: route > view > serializer > model.
  • Uses Django REST Framework's conventions to minimize configuration.
  • All tests…

Django-REST-Assured adds another layer on top of Django REST Framework’s APITestCase which allows covering a set of RESTful resource’s endpoints with a single class declaration.


meshy/django-schema-graph: An interactive graph of your Django model structure

GitHub logo meshy / django-schema-graph

An interactive graph of your Django model structure

Django Schema Graph

Django-schema-graph makes a colourful diagram out of your Django models. The diagram is interactive, and makes it easy to toggle models and apps on/off at will.

It looks like this:

Feature Screenshot
Models models screenshot
Apps apps screenshot
Both together models and apps screenshot
Graph editor menu screenshot

(Apologies that the images above don't work on PyPI. Check it out on GitHub.)

Installation

Install from PyPI:

pip install django-schema-graph

Add to INSTALLED_APPS:

INSTALLED_APPS = [
    'schema_graph'
]

Add to your URLs.

from schema_graph.views import Schema
urlpatterns += [
    # On Django 2+:
    path("schema/", Schema.as_view())
    # Or, on Django < 2:
    url(r"^schema/$", Schema.as_view()),
]

Use

Browse to /schema/ (assuming that's where you put it in your URLs).

Note: DEBUG mode is required, on the assumption that you don't want to leak sensitive information about your website outside of…

Django Schema Graph creates a colorful diagram out of your Django models apps.

Discussion (0)

pic
Editor guide