This is a common case in django ORM.
from django.db import models
class Author(models.Model):
/** | |
* jQuery plugin for Django inlines | |
* | |
* - When a `.js-django-inlines` is present, it will automatically enable this script for it. | |
* - When `.js-add-form` is missing, an add button will be inserted manually. | |
* - Make sure a `.js-remove-form` element is present in the HTML. | |
* | |
* To customize the behavior, use different class names and manually call $formset.djangoInline(). | |
* This can also be used to manually connect the 'add' and 'delete' buttons. | |
* |
def pretty_request(request): | |
headers = '' | |
for header, value in request.META.items(): | |
if not header.startswith('HTTP'): | |
continue | |
header = '-'.join([h.capitalize() for h in header[5:].lower().split('_')]) | |
headers += '{}: {}\n'.format(header, value) | |
return ( |
Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// see: https://github.com/chadoe/docker-cleanup-volumes
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.
# Standard HTTP-to-gRPC status code mappings | |
# Ref: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md | |
# | |
error_page 400 = @grpc_internal; | |
error_page 401 = @grpc_unauthenticated; | |
error_page 403 = @grpc_permission_denied; | |
error_page 404 = @grpc_unimplemented; | |
error_page 429 = @grpc_unavailable; | |
error_page 502 = @grpc_unavailable; | |
error_page 503 = @grpc_unavailable; |