Run the following command
$ update-locale LC_ALL="en_US.UTF-8"
If it failed, you will need to add the following to /var/lib/locales/supported.d/local file
en_US.UTF-8 UTF-8
#!/usr/bin/env python | |
from django.db.models.aggregates import Aggregate | |
from django.db.models.sql.aggregates import Aggregate as SqlAggregate | |
from django.db.models.sql.query import Query | |
class SqlGetter(SqlAggregate): | |
sql_function = '' | |
class SqlQuery(Query): |
def serialize_object(obj): | |
args = [] | |
for field in obj._meta.fields: | |
value = field.value_from_object(obj) | |
if value and value != field.default: | |
from decimal import Decimal | |
if isinstance(value, unicode): | |
try: | |
value = str(value) | |
except UnicodeEncodeError: |
#!/usr/bin/env python | |
import os | |
import site | |
import sys | |
sys.dont_write_bytecode = True # don't write .pyc files | |
sys.argv[0] = os.path.abspath(__file__) # show full path in ps and top | |
sys.path.append(os.path.dirname(__file__)) | |
site.addsitedir('/path/to/virtenv/lib/python2.7/site-packages') | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'demo.settings' |
1:20 PM <collinanderson> i had one really, really crazy idea that i almost posted on the thread back in the day. why no just have a _meta.fields that _is_ an OrderedDict of _all_ (non related object?) fields. it would be name -> field_instance | |
1:21 PM <collinanderson> that way you don't even need .get_field() (singular). you just say _meta.fields['field_name'] | |
1:21 PM <collinanderson> though you would likely do a lot of iterating over _meta.fields.values() | |
1:22 PM <collinanderson> that way it would preserve the order |
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; |
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) |
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 |
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' |
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 |