Skip to content

Instantly share code, notes, and snippets.

View collinanderson's full-sized avatar

Collin Anderson collinanderson

  • South Bend, Indiana
View GitHub Profile
./accounts/tests.py:1:1: F401 'TestCase' imported but unused
./accounts/views.py:7:1: E302 expected 2 blank lines, found 1
./accounts/admin.py:1:1: F401 'admin' imported but unused
./accounts/forms.py:4:1: E302 expected 2 blank lines, found 1
./accounts/migrations/0001_initial.py:17:80: E501 line too long (114 > 79 characters)
./accounts/migrations/0001_initial.py:18:80: E501 line too long (88 > 79 characters)
./accounts/migrations/0001_initial.py:19:80: E501 line too long (103 > 79 characters)
./accounts/migrations/0001_initial.py:20:80: E501 line too long (196 > 79 characters)
./accounts/migrations/0001_initial.py:24:80: E501 line too long (266 > 79 characters)
./accounts/migrations/0001_initial.py:25:80: E501 line too long (229 > 79 characters)
FAIL: test_get_fields_error_when_apps_not_ready (model_meta.tests.GetFieldByNameTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/collin/django1.8/tests/model_meta/tests.py", line 186, in test_get_fields_error_when_apps_not_ready
opts.get_field('some_missing_field')
AssertionError: "Person\ has\ no\ field\ named\ \'some\_missing\_field\'\.\ The\ app\ cache\ isn\'t\ ready\ yet\,\ so\ if\ this\ is\ an\ auto\-created\ related\ field\,\ it\ might\ not\ be\ available\ yet\." does not match "Person has no field named 'some_missing_field'. The app cache isn't ready yet, so if this is an auto-created related field, it may not be available yet."
======================================================================
FAIL: test_unpickling_when_appregistrynotready (model_regress.test_pickle.ModelP
ickleTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\collin\Documents\GitHub\django1.8\tests\model_regress\test_pick
le.py", line 93, in test_unpickling_when_appregistrynotready
str('PATH'): os.environ['PATH'],
subprocess.CalledProcessError: Command '['C:\\Python34\\python.exe', 'C:\\Users\
\collin\\Documents\\GitHub\\django1.8\\mh58f5zp.py']' returned non-zero exit sta
import importlib
import os
import shutil
testmod = os.path.join(os.path.dirname(__file__), 'testmod')
os.mkdir(testmod)
with open(os.path.join(testmod, '__init__.py'), 'w') as f:
f.write('pass')
mod1 = os.path.join(testmod, 'mod1')
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 5 2014, 20:42:22)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
sys.path[0] is '/Users/collin/django1.8/tests'
os.listdir('/Users/collin/django1.8/tests/migrations/migrations_22') is ['0001_my_initial_migration.py', '__init__.py']
self.migration_pkg is 'migrations.migrations_22'
Traceback (most recent call last):
Collins-MBP:tests collin$ PYTHONPATH=.. python3 ./runtests.py --failfast migrations.test_commands
Testing against Django installed in '/Users/collin/django1.8/django'
Creating test database for alias 'default'...
Creating test database for alias 'other'...
.....................F
======================================================================
FAIL: test_makemigrations_with_custom_name (migrations.test_commands.MakeMigrationsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/collin/django1.8/tests/migrations/test_commands.py", line 691, in test_makemigrations_with_custom_name
@collinanderson
collinanderson / user_hack.py
Last active August 29, 2015 14:13
username length hack
AbstractUser._meta.get_field('username').max_length = 75 # HACK
for v in AbstractUser._meta.get_field('username').validators:
if getattr(v, 'limit_value', '') == 30:
v.limit_value = 75
class User(AbstractUser):
class Meta:
db_table = 'auth_user'
@collinanderson
collinanderson / python3
Last active August 29, 2015 14:11
Alternative Packages with Python 3 support.
Most of these packages are forks of the original.
MySQL-python -> mysqlclient
suds -> suds-jurko
django-registration -> django-registration-redux
fabric -> no support yet?
gevent -> no support yet?
akismet -> pykismet3
django-storages -> django-storages-redux
xlwt -> xlwt-future
@collinanderson
collinanderson / adminsearch.py
Last active August 29, 2015 14:11
admin search
qs = Model.objects.all()
for kw in q.split():
q = models.Q()
for f in fields:
q |= Q('%s__iexact' % f.name: kw)
qs = qs.filter(q)
server {
server_name example.com;
root /path/to/php;
location / {
index index.php;
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php5-fpm.sock;