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.
Sponsored Link
Django Styleguide
HackSoftware / Django-Styleguide
Django styleguide used in HackSoft projects
Django Styleguide
👀 Need help with your Django project? HackSoft can make it easy for you. Reach out atconsulting@hacksoft.io
Table of contents:
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
ydaniv / django-rest-assured
Instantly test-cover your Django REST Framework based API
django-rest-assured
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
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:
(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).
You can control access to this page using the SCHEMA_GRAPH_VISIBLE
setting
or by subclassing schema_graph.views.Schema
and overriding access_permitted
.
By default…
Django Schema Graph creates a colorful diagram out of your Django models apps.
Top comments (0)