Django News #16 - Wagtail roadmap, lots of Django, a new(ish) JS framework that we like, and more working remote tips.

jefftriplett

Jeff Triplett (he/him)

Posted on April 2, 2020

Django News #16 - Wagtail roadmap, lots of Django, a new(ish) JS framework that we like, and more working remote tips.

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.


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.

GitHub logo alpinejs / alpine

A rugged, minimal framework for composing JavaScript behavior in your markup.

Alpine.js

Go to the Alpine docs for most things: Alpine Docs

You are welcome to submit updates to the docs by submitting a PR to this repo. Docs are located in the /packages/docs directory.

Stay here for contribution-related information.

Looking for V2 docs? here they are

Alpine Compoenent Patterns

Contribution Guide:

Quickstart

  • clone this repo locally
  • run npm install & npm run build
  • Include the /packages/alpinejs/dist/cdn.js file from a <script> tag on a webpage and you're good to go!

Brief Tour

You can get everything installed with: npm install in the root directory of this repo after cloning it locally.

This repo is a "mono-repo" using npm workspaces for managing the packages. Each package has its own folder in the /packages directory.

Rather than having to run separate builds for each package, all package bundles are handled with the same command: npm run build

Here's a brief look at each package in this…


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.

GitHub logo 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: https://github.com/jamesturk/django-honeypot/

Requirements

  • python >= 3.7
  • 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".

HONEYPOT_VALUE is an option that you can specify to populate the honeypot field, by default the honeypot field will be empty and any text entered into it will result in a failed POST. HONEYPOT_VALUE can be a string…


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.

GitHub logo 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
Enter fullscreen mode Exit fullscreen mode

2. Activate

Enable the Django management command by extending your Django project settings:

INSTALLED_APPS += ("django_createsuperuserwithpassword", )
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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.




💖 💪 🙅 🚩
jefftriplett
Jeff Triplett (he/him)

Posted on April 2, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related