News
Wagtail roadmap priorities 2020
We're reviewing our roadmap for the next 12 months and we'd love your input. If you use Wagtail, please help shape our plans.
PyCon US 2020 in Pittsburgh, Pennsylvania is cancelled
The PSFβs priority is the health and safety of the community and the COVID-19 (Coronavirus) pandemic has made it unsafe to hold PyCon US this year.
Pipenv new release
A new Pipenv release is due at the end of the month.
Articles
Using Django Check Constraints to Ensure Only One Field Is Set
From Adam Johnson, a demonstration of using check constraints in a Django model.
How Eldarion Works Remotely β Eldarion Blog
Notes on working remotely from a leading Django consultancy.
East Meets West When Translating Django Apps
Notes from a PyCascades 2020 talk on using Django's built-in translation app.
Postgres VIEW from Django QuerySet
How (and why) to use Django's ORM to generate a Postgres VIEW.
How to restrict access with Django Permissions
A look at the various ways to implement Django permissions.
Double-checked locking with Django ORM
How to implement double-checked locking within Django.
Designing a User-Friendly ML Platform with Django
Creating a Django web interface for an existing Machine Learning platform.
Sponsored Link
From HackSoft, a styleguide for Django projects at scale.
HackSoftware
/
Django-Styleguide
Django styleguide used in HackSoft projects
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
- Cookie Cutter
- Models
- Services
- Selectors
- APIs & Serializers
- Urls
- Exception Handling
- Testing
- Celery
- Misc
- Inspiration
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β¦
Podcasts
Django Chat - Google Summer of Code with Sage Abdullah
Sage was a 2019 Google Summer of Code student and contributed cross-db JSONField support coming in Django 3.1. We discuss his background in programming and advice for future student contributors.
PythonBytes #168 - Featuring Kojo Idrissa
A discussion of Pipenv, virtualenv, and PyCon with Kojo Idrissa.
Tutorials
LearnDjango - Trailing URL Slashes in Django
A look at Django's APPEND_SLASH setting which automatically adds a trailing slash to URL paths if the user doesn't add one themself.
Personalized Python Prompts
A short guide to personalizing the Python interpreter prompt.
Introduction to SQLAlchemy ORM for Django Developers
A robust comparison of Django's ORM to SQLAlchemy, typically used with Flask.
Projects
alpinejs/alpine: A rugged, minimal framework for composing JavaScript behavior in your markup.
Alpine.js is a great JS framework to have in your toolbox when you don't need a big framework like Vue or React yet shares a similar syntax with Vue. The best part is that you can start using it by linking to a CDN version without having to configure or compile anything.
Alpine.js
Alpine.js offers you the reactive and declarative nature of big frameworks like Vue or React at a much lower cost.
You get to keep your DOM, and sprinkle in behavior as you see fit.
Think of it like Tailwind for JavaScript.
Note: This tool's syntax is almost entirely borrowed from Vue (and by extension Angular). I am forever grateful for the gift they are to the web.
Translated documentation
Language | Link for documentation |
---|---|
Japanese | ζ₯ζ¬θͺγγγ₯γ‘γ³γ |
Chinese Traditional | ηΉι«δΈζθͺͺζζδ»Ά |
Russian | ΠΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΡ Π½Π° ΡΡΡΡΠΊΠΎΠΌ |
Portuguese | DocumentaΓ§Γ£o em PortuguΓͺs |
Install
From CDN: Add the following script to the end of your <head>
section.
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.x.x/dist/alpine.min.js" defer></script>
That's it. It will initialize itself.
For production environments, it's recommended to pin a specific version number in the link to avoid unexpected breakage from newer versions
For example, to use version 2.6.0
(latest):
<script src
β¦jamesturk/django-honeypot: π― Generic honeypot utilities for use in django projects.
Provides template tags, view decorators, and middleware to add and verify honeypot fields to forms.
jamesturk
/
django-honeypot
π― Generic honeypot utilities for use in django projects.
django-honeypot
Django application that provides utilities for preventing automated form spam.
Provides template tags, view decorators, and middleware to add and verify honeypot fields to forms.
Written by James Turk with contributions by Flavio Curella and Daniel Greenfeld.
Source: http://github.com/jamesturk/django-honeypot/
Requirements
- python >= 3.6
- django >= 2.2
(django-honeypot 0.7 supports Django 1.11 and Python 2.7)
Usage
settings.py
Be sure to add honeypot
to INSTALLED_APPS
in settings.py.
You will almost always need to define HONEYPOT_FIELD_NAME
which is the name to use for the honeypot field. Some sophisticated bots will attempt to avoid fields named honeypot, so it may be wise to name the field something slightly more realistic such as "phonenumber" or "body2". (Note: be sure not to name the field anything that will conflict with other forms on your page, "name" is a good example of a field that will likely cause issues.)
HONEYPOT_VALUE
is an option that you canβ¦
hartwork/django-createsuperuserwithpassword: Django management command to create usable super users, programmatically
Django management command to programmatically create usable super users.This is great for local Docker development, but please skip for production.
hartwork
/
django-createsuperuserwithpassword
Django management command to create usable super users, programmatically
django-createsuperuserwithpassword
β¦ provides a Django management command to create ready-to-login super users during development.
How to Use
1. Install
Install the pip package locally or globally:
pip install [--user] django-createsuperuserwithpassword
2. Activate
Enable the Django management command by extending your Django project settings:
INSTALLED_APPS += ("django_createsuperuserwithpassword", )
3. Apply
Call the command β e.g. from within a container entrypoint script β like this:
python manage.py createsuperuserwithpassword \
--username admin \
--password admin \
--email admin@example.org \
--preserve
Development
If you want to help fix a bug, an easy way to spin up a development environment is:
git clone https://github.com/hartwork/django-createsuperuserwithpassword
cd django-createsuperuserwithpassword
docker-compose up --build
Authors
django-createsuperuserwithpassword is based on code by Adam Charnock licensed under the MIT license that started out at adamcharnock/swiftwind-heroku.
Sebastian Pipping added and fixed a few things, on top.
Top comments (0)