This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
l = logging.getLogger('django.db.backends') | |
l.setLevel(logging.DEBUG) | |
l.addHandler(logging.StreamHandler()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOGGING = { | |
... | |
'handlers': { | |
'console': { | |
'level': 'DEBUG', | |
'class': 'logging.StreamHandler', | |
}, | |
... | |
}, | |
'loggers': { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if not hasattr(ForeignModel, "tags"): | |
t = TaggableManager() | |
t.contribute_to_class(ForeignModel, "tags") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
====================================================================== | |
ERROR: test_not_logged_in (profiles.tests.RepLoginRequiredDecoratorTests) | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "./profiles/tests.py", line 54, in test_not_logged_in | |
self.assertRedirects(response, settings.LOGIN_URL) | |
File "/Users/jacob/.virtualenvs/regis-support/lib/python2.6/site-packages/django/test/testcases.py", line 389, in assertRedirects | |
redirect_response = response.client.get(path, QueryDict(query)) | |
AttributeError: 'HttpResponseRedirect' object has no attribute 'client' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[31] >>> CreateTicket.__mro__ | |
[31] : | |
(<class 'tickets.views.CreateTicket'>, | |
<class 'tickets.views.LoginRequired'>, | |
<class 'django.views.generic.edit.CreateView'>, | |
<class 'django.views.generic.detail.SingleObjectTemplateResponseMixin'>, | |
<class 'django.views.generic.base.TemplateResponseMixin'>, | |
<class 'django.views.generic.edit.BaseCreateView'>, | |
<class 'django.views.generic.edit.ModelFormMixin'>, | |
<class 'django.views.generic.edit.FormMixin'>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INI_HEADER = '''[tox] | |
setupdir = {toxinidir}/upstream | |
''' | |
ENV_TEMPLATE = '''[testenv:%(envname)s] | |
basepython = %(pyver)s | |
deps = %(deps)s | |
setenv = | |
PYTHONPATH={toxinidir} | |
commands = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from .forms import MyWizard | |
class MyWizardAdmin(admin.WizardAdmin): | |
wizard = MyWizard | |
... | |
admin.site.register(MyWizardAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"slaves": { | |
"passwords": { | |
"*": "sekrit" | |
} | |
}, | |
"irc": { | |
"password": "sekrit" | |
}, | |
"cloudservers": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': True, | |
'handlers': { | |
'console': { | |
'level': 'ERROR', | |
'class': 'logging.StreamHandler' | |
} | |
}, | |
'loggers': { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core import urlresolvers | |
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned | |
from django.db import transaction | |
from tastypie.exceptions import BadRequest | |
from tastypie.http import HttpAccepted, HttpGone, HttpMultipleChoices | |
from tastypie.utils import dict_strip_unicode_keys | |
class Patchable(object): | |
""" | |
Mixin adding PATCH support to a ModelResource. |