Skip to content

Instantly share code, notes, and snippets.

apps_a = Apps()
apps_b = Apps()
class A(models.Model):
class Meta:
apps = apps_a
class B(models.Model):
a = models.ForeignKey(A)
@charettes
charettes / gist:4d65686bc89f187e53fd
Created September 4, 2014 21:05
to_field inline fix
From a3c6349b2c799bd45c3f250d0c03b81f5b03a91e Mon Sep 17 00:00:00 2001
From: Simon Charette <charette.s@gmail.com>
Date: Thu, 4 Sep 2014 17:04:53 -0400
Subject: [PATCH] Inline fix.
---
django/contrib/admin/options.py | 10 +++++++++-
tests/admin_views/admin.py | 13 ++++++++++++-
tests/admin_views/models.py | 12 ++++++++++++
tests/admin_views/tests.py | 5 +++++

Keybase proof

I hereby claim:

  • I am charettes on github.
  • I am charettes (https://keybase.io/charettes) on keybase.
  • I have a public key whose fingerprint is 8557 62CE 0C47 C935 9480 44AA 72AF 89A0 B1B4 EDB3

To claim this, I am signing this object:

(django-sundial)simon@simon-laptop:~/workspace/django-sundial$ python setup.py bdist_wheel --universal
running bdist_wheel
running build
installing to build/bdist.linux-x86_64/wheel
running install
running install_egg_info
running egg_info
creating django_sundial.egg-info
writing requirements to django_sundial.egg-info/requires.txt
writing django_sundial.egg-info/PKG-INFO
diff --git a/django/test/runner.py b/django/test/runner.py
index 1106c52..e053bd3 100644
--- a/django/test/runner.py
+++ b/django/test/runner.py
@@ -211,6 +211,27 @@ class DiscoverRunner(object):
result = self.run_suite(suite)
self.teardown_databases(old_config)
self.teardown_test_environment()
+ from itertools import groupby
+ def keyfunc(test):
var input = Sizzle('[required]')[0]; //input#field
Sizzle.matches('[required]', [input]); // [ ]
<!doctype html>
<html>
<head>
</head>
<body>
<input name="field" type="text" required/>
</body>
<html>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Django Docs Search</ShortName>
<Description>Search in Django Documents</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAapJREFUOI2lk09I02EYxz/P+/78uSxQUnfISsibHjqI4C7u0KZCkwoFMVL0kOAlPIlg4CEI8aztqB4UCqQYbY4IPBRLLwV1NAJJFPOghenU358Oc6MfmxPqe3rg/T6f9/nDI+Mzk+7rD2/4F0UCrUjjYMgtZlKiAHBcp/B7sWTTKGE1mmTl2RJaaVJTcVaml/CZvpzHKAYQERBBsmbDyFV0LqDiUjla6UyyZBDBR3cRIH2cLgxQSjHQ3kNXsIPqiso8aGJiAVFC+0g36eOjfMCDUBdDd/qxbItX7xLs7v+kr60brTJlX7xQhlJFWogEWgGYSz4nGpsF4H6oE63M06FknbnAu4Wq8ssAfNtazx/KGfIAtnd3AAg0NOUZRcTzc1aeFl4sxxjrHSYSCHOzrp69/V+YRgkAPrMUdboN27ELA16+j2M7Nj237nHjSi3X/DUcHqX5/mOT6/6rAPw+PODEOikMAIilksRSSUQErTSWbaFEePrwMQCfvn45u4W/5boulm2hlebJwCihxhYc12H+7aJ3NucdE2Ru4nZzmPXtDT6uffYC/vec/wDjbXl0qXpOzgAAAABJRU5ErkJggg==</Image>
<Url type="text/html"
@charettes
charettes / authuser.md
Created April 3, 2012 17:46 — forked from jacobian/authuser.md
Upgrading auth.User - the profile approach

Upgrading auth.User - the profile approach

This proposal presents a "middle ground" approach to improving and refactoring auth.User, based around a new concept of "profiles". These profiles provide the main customization hook for the user model, but the user model itself stays concrete and cannot be replaced.

I call it a middle ground because it doesn't go as far as refactoring the whole auth app -- a laudable goal, but one that I believe will ultimately take far too long -- but goes a bit further than just fixing the most egregious errors (username length, for example).

This proposal includes a fair number of design decisions -- you're reading the fifth or sixth draft. To keep things clear, the options have been pruned out and on the one I think is the "winner" is still there. But see the FAQ at the end for some discussion and justification of various choices.

The User model

@charettes
charettes / django-github-pull-ticket-linkify.js
Last active October 3, 2015 21:28
Linkify ticket numbers in django github pull request
// ==UserScript==
// @name Django github ticket number linkify
// @namespace django-github-ticket-linkify
// @description Linkify ticket numbers to django's track on github
// @grant none
// @include https://github.com/*/django/*
// ==/UserScript==
const TICKET_NUMBER_LINKIFY = ' <a target="_new" href="https://code.djangoproject.com/ticket/$1">#$1</a>';