Skip to content

Instantly share code, notes, and snippets.

@luto
luto / enum_choices.py
Created August 8, 2019 14:12
django model enum choices
from enum import Enum
class Choices(Enum):
"""
Helper to construct choices for django Model or Form fields.
class Animals(Choices):
DOG = 'dog'
CAT = 'cat'
@luto
luto / keybase.md
Created September 21, 2017 12:17
keybase.md

Keybase proof

I hereby claim:

  • I am luto on github.
  • I am luto (https://keybase.io/luto) on keybase.
  • I have a public key whose fingerprint is DD23 B84B 255E F8DC 58C0 BC56 1D75 51A7 7693 8B66

To claim this, I am signing this object:

@luto
luto / reverseadmin.py
Last active August 29, 2015 14:03 — forked from andybak/reverseadmin.py
"""
adminreverse from here http://djangosnippets.org/snippets/2032/
changed for working with ForeignKeys
Fixed for Django 1.6 by @andybak
reverseadmin
============
Module that makes django admin handle OneToOneFields in a better way.
A common use case for one-to-one relationships is to "embed" a model
var amqp = require('amqp');
var connection = amqp.createConnection(
{
host: 'messages.streams.xenim.de',
vhost: "xsn_hls",
login: "shownotes",
password: nconf.get("xsn_pw")
}
);