Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
Choose a Base Repository
django/django
Acidburn0zzz/django
AndreaCrotti/django
BooBSD/django
Bouke/django
EmployInsight/django
Epictetus/django
GaussCheng/django
Gautier/django
Gildus/django
JannKleen/django
MechanisM/django
PaulMcMillan/django
Psycojoker/django
SmileyChris/django
Txerrinko/django
aashudwivedi/django
ademaro/django
adrianholovaty/django
afei418/django
akaariai/django
allanfreitas/django
allisonmobley/django
andrewgodwin/django
andrewjesaitis/django
andrewsmedina/django
andymckay/django
apollo13/django
ashgadala/django
ashwoods/django-1
atlassian/django
atul-bhouraskar/django
audreyr/django
beanbaginc/django
bennylope/django
bilalahmad1994/django
bmihelac/django-1
bmispelon/django
bohyn/django
brad/django
bradbeattie/django
brianriley/django
btubbs/django
carljm/django
charettes/django
chrisdew/django
chrisglass/django
chrishas35/django
claudep/django
crodjer/django
danawoodman/django
danielroseman/django
datajockey/django
davedash/django-1
davideklund/django
dgerzo/django
dhepper/django
dittaeva/django
django-nonrel/django
djworth/django
dkuznetsov/django
douglas/django
dstufft/django
duilio/django
dwatkinsweb/django
econchick/django
edmoody/django
ei-grad/django
ershadul/django
evildmp/django
fabianbuechler/django
fengsi/django
fgo/django
freakboy3742/django
gabejackson/django
gabrielhurley/django
gaker/django
geodesign/django
gertjanjansen/django
ghing/django
gilsondev/django
graemeglass/django
grapo/django
gs412/django
httpdss/django
ibrahimcesar/django
idan/django
ikeikeikeike/django
ivensrocha/django
jakul/django
jandas/django
jarayabozo/django
jarshwah/django
jaylett/django
jdhardy/django
jiangzhonghui/django
jmolmo/django
jphalip/django
jsma/django
judy2k/django
justzx2011/django
karthikabinav/django
kcunning/django
keimlink/django
kemi56/django
kennethlove/django
kenthauser/django
kipanshi/django-1
kkszysiu/django
kleinmatic/django
kmikzjh/django
koniiiik/django
ktemo/django
ladyrassilon/django
leereilly/django-1
lenin/django
lightyoruichi/django
liuhongchao/django
loic/django
lqc/django
manfre/django
maraujop/django
marcneuwirth/django
martar/django
matheussl/django
max-arnold/django
metllord/django
mick/django
milin/django
mitar/django
mjtamlyn/django
moorick/django
mortenthansen/django
morty/django
mpaolini/django
msabramo/django
muratcorlu/django
natebragg/django
netconstructor/django
netoxico/django
newmaniese/django
nimbis/django
nmfm/django
ogier/django
oinopion/django
ojii/django
originalgremlin/django1.4
ozgurgunes/django
pawan-darda/django
payeldillip/django
peachananr/django
pelme/django
philipkimmey/django-1
programmerq/django
ptone/django
pvanderlinden/django
pvl/django
ra21vi/django
rafaduran/django
ramiro/django
rasca/django
revskill/django
rmboggs/django
robgolding/django
rpedigoni/django
ryankask/django
sachingupta006/django
samuraisam/django
saschpe/django
sassman/django
saxix/django
sebastianviera/django
shekharsharma/django
sjaensch/django
skada/django
spookylukey/django
starenka/django
stefanklug/django
t20/django
tarsisazevedo/django
the5fire/django-inside
theodesp/django
timgraham/django
tinio/django
tschellenbach/django
tswicegood/django
tuxcanfly/django
ulope/django
umazalakain/django
valhallasw/django
vdt/django
vsajip/django
webjunkie/django
xyzzy32/django
yumike/django
yuvadm/django
zhj12ab/django
zuotian/django
zuzelvp/django
zzp/django
Nothing to show
Choose a Head Repository
django/django
Acidburn0zzz/django
AndreaCrotti/django
BooBSD/django
Bouke/django
EmployInsight/django
Epictetus/django
GaussCheng/django
Gautier/django
Gildus/django
JannKleen/django
MechanisM/django
PaulMcMillan/django
Psycojoker/django
SmileyChris/django
Txerrinko/django
aashudwivedi/django
ademaro/django
adrianholovaty/django
afei418/django
akaariai/django
allanfreitas/django
allisonmobley/django
andrewgodwin/django
andrewjesaitis/django
andrewsmedina/django
andymckay/django
apollo13/django
ashgadala/django
ashwoods/django-1
atlassian/django
atul-bhouraskar/django
audreyr/django
beanbaginc/django
bennylope/django
bilalahmad1994/django
bmihelac/django-1
bmispelon/django
bohyn/django
brad/django
bradbeattie/django
brianriley/django
btubbs/django
carljm/django
charettes/django
chrisdew/django
chrisglass/django
chrishas35/django
claudep/django
crodjer/django
danawoodman/django
danielroseman/django
datajockey/django
davedash/django-1
davideklund/django
dgerzo/django
dhepper/django
dittaeva/django
django-nonrel/django
djworth/django
dkuznetsov/django
douglas/django
dstufft/django
duilio/django
dwatkinsweb/django
econchick/django
edmoody/django
ei-grad/django
ershadul/django
evildmp/django
fabianbuechler/django
fengsi/django
fgo/django
freakboy3742/django
gabejackson/django
gabrielhurley/django
gaker/django
geodesign/django
gertjanjansen/django
ghing/django
gilsondev/django
graemeglass/django
grapo/django
gs412/django
httpdss/django
ibrahimcesar/django
idan/django
ikeikeikeike/django
ivensrocha/django
jakul/django
jandas/django
jarayabozo/django
jarshwah/django
jaylett/django
jdhardy/django
jiangzhonghui/django
jmolmo/django
jphalip/django
jsma/django
judy2k/django
justzx2011/django
karthikabinav/django
kcunning/django
keimlink/django
kemi56/django
kennethlove/django
kenthauser/django
kipanshi/django-1
kkszysiu/django
kleinmatic/django
kmikzjh/django
koniiiik/django
ktemo/django
ladyrassilon/django
leereilly/django-1
lenin/django
lightyoruichi/django
liuhongchao/django
loic/django
lqc/django
manfre/django
maraujop/django
marcneuwirth/django
martar/django
matheussl/django
max-arnold/django
metllord/django
mick/django
milin/django
mitar/django
mjtamlyn/django
moorick/django
mortenthansen/django
morty/django
mpaolini/django
msabramo/django
muratcorlu/django
natebragg/django
netconstructor/django
netoxico/django
newmaniese/django
nimbis/django
nmfm/django
ogier/django
oinopion/django
ojii/django
originalgremlin/django1.4
ozgurgunes/django
pawan-darda/django
payeldillip/django
peachananr/django
pelme/django
philipkimmey/django-1
programmerq/django
ptone/django
pvanderlinden/django
pvl/django
ra21vi/django
rafaduran/django
ramiro/django
rasca/django
revskill/django
rmboggs/django
robgolding/django
rpedigoni/django
ryankask/django
sachingupta006/django
samuraisam/django
saschpe/django
sassman/django
saxix/django
sebastianviera/django
shekharsharma/django
sjaensch/django
skada/django
spookylukey/django
starenka/django
stefanklug/django
t20/django
tarsisazevedo/django
the5fire/django-inside
theodesp/django
timgraham/django
tinio/django
tschellenbach/django
tswicegood/django
tuxcanfly/django
ulope/django
umazalakain/django
valhallasw/django
vdt/django
vsajip/django
webjunkie/django
xyzzy32/django
yumike/django
yuvadm/django
zhj12ab/django
zuotian/django
zuzelvp/django
zzp/django
Nothing to show
Choose a head branch
abstract_overrides
add_filter_fix
add_filter_fix_19
add_relation
add_test_requirements
akaariai_committer
always_process_response
annotate_join_cond
annotate_order_by_values
assertqs_ordering
available_apps_more
backpatch_18
cache_orm_tx
cache_orm
callable_transforms
chain_ops
custom_lookups
custom_refs_19385
dates_expressions
datetime_cast_fix
db_schemas
dedupe_cols
defer_alt
defer_getattr
defer_inheritance_pk
defer_only_interaction
deprecation_subclasses
disjuction_promotion
distance_order_by
django_git_guidelines
dupe_away
exclude_combine
exprs_in_filter
fast_delete
fast_init_and_nonchunked
fast_init_test
fast_init
fast_tests_merged
faster_iterator
field_pickle
final
fix_duration_on_sqlite
fix_oracle
fix_oracle2
fix_proxy_model_inheritance
fix_select_related_perf
fix_singletableinh
fixture_improvement
generic_rel_jax
generic_rel_reverse
generic_rel_target
get_default
get_pk_on_save
group_by_expr
inheritance_custom_pk_m2m
isolated_apps
jarshwah-ticket-23001
jdunck_preinit
join_class
join_reuse_fix
join_trim_improv
liveserver_issue
lookups_3_final
lookups_3
m2m_regress_fix
manager_factory
manager_methods
manual_savepoint_atomic
master
meta_refactor
meta_table_api
model_annotation
model_eq_inherit
model_eq_nopk
model_eq_proxy
model_from_db
model_modified_poc
model_new
model_save_refactor_squash
model_save_refactor
model_state_improvements
move_bilaterals_to_lookups
mssql_test_constraints
mssql_tests_1.8
names_to_path_to_fields
nested_lookups
new_tx
new_10790_rm_trim
new_10790
non_chunked_iter_squashed
non_chunked_reads
nonaggregate-annotations
not_and_having
only_load_bug
oracle_in_fix
oracle_promotion_fix
oracle_py3
oracle_regex_fix
oragisfix
order_join_promotion
ordered_dict_on_need
orm_perf
orm_py3
orm_readme
orm_refactorings
orm_16_release_notes
parallel_isolated_apps
perm_in_perms
pgsql_cached
postgis2
pr_5163
pull_38_fix
pull_67
pull_407
pull_1240
pull_1685_simpler_queries
pull_1685
queryset_to_query_in_filter
refactor_utils_tree
refactor_utils_tree_2
rel_field_get_lookup
rel_fix
rel_manager_tx_fixes
related_rel_removal
remove_rel_usage
reverse_generic_rel
reverse_unique
rm_emptyqs
rm_get_ordered_objects
rm_select_fields
select_cols_cached
select_cols_gis
select_cols
select_on_save
select_on_save_16
simple_build_lookup
simplify_count_query
skip_bcrypt
skip_validation
soc2013/composite-fields
split_exclude_cleanup
splitted_clone
test_auto_settings
test_state_tracking
ticket_901
ticket_3011
ticket_3881
ticket_4102_niwibe
ticket_8467_test
ticket_10790_final
ticket_10790_new
ticket_10790
ticket_11521
ticket_12885
ticket_13781
ticket_14030_alt
ticket_14030
ticket_15915_fix
ticket_15933_alt
ticket_16047
ticket_16187_cherrypick
ticket_16187_new
ticket_16187
ticket_16211_fix
ticket_16211
ticket_16426_new
ticket_16426
ticket_16426_2
ticket_16679
ticket16715_more
ticket16715
ticket_16759
ticket_17485_fix
ticket_17541_for_15
ticket_17541
ticket_17750
ticket_17788_backpatch
ticket_17788
ticket_17886
ticket_17957
ticket_18082
ticket_18163
ticket_18169
ticket_18175
ticket_18248
ticket_18251
ticket_18304
ticket_18305_both
ticket_18305
ticket_18306
ticket_18324
ticket_18347
ticket_18375_alt
ticket_18375_bc
ticket_18375_new
ticket_18375
ticket_18676_fix
ticket_18726
ticket_18748_comb
ticket_18748
ticket_18823
ticket_18843_fix
ticket_18979
ticket_19167
ticket_19197
ticket_19274
ticket_19276
ticket_19326
ticket_19385_squash
ticket_19385
ticket_19385_2_rebased
ticket_19385_2
ticket_19645
ticket_19707_14
ticket_19837
ticket_19964_opt_2
ticket_19964
ticket_20289
ticket_20289_14
ticket_20434
ticket_20528
ticket_20600
ticket_20874
ticket_21126
ticket_21126_15
ticket_21126_16
ticket_21134
ticket_21150
ticket_21160
ticket_21169
ticket_21203
ticket_21428_master
ticket_21428
ticket_21431
ticket_21696
ticket_21748
ticket_21748_16
ticket_21787
ticket_21825
ticket_21863
ticket_21903_16
ticket_21952
ticket_22429
ticket_22994
ticket_23372
ticket_23605
ticket_23622
ticket_23791
ticket_23877
ticket_24090
ticket_24171
ticket_24279
ticket_24605
ticket_24705
ticket_24748
ticket_24752
ticket_24766
ticket_24923
ticket_25307
ticket_26092
ticket_26196_fix
tx_improvements
tx_improvements_2
unicode_label
unicode_label_15
update_cascade
use_resolve_ref
virtual_rel_field
warn_missing_keys
where_as_sql
Nothing to show
Checking mergeability… Don’t worry, you can still create the pull request.
Commits on Nov 30, 2013
Commits on Dec 01, 2013
Commits on Dec 21, 2013
Merge branch 'master' into lookups_3
Conflicts:
	django/db/models/fields/__init__.py
	django/db/models/sql/compiler.py
	django/db/models/sql/query.py
	tests/null_queries/tests.py
Commits on Dec 28, 2013
Proof-of-concept fix for #16731
Implemented only for SQLite and PostgreSQL, and only for startswith
and istartswith lookups.
Commits on Dec 29, 2013
Commits on Jan 11, 2014
Altered query string customization for backends vendors
The new way is trying to call first method 'as_' + connection.vendor.
If that doesn't exist, then call as_sql().

Also altered how lookup registration is done. There is now
RegisterLookupMixin class that is used by Field, Extract and
sql.Aggregate. This allows one to register lookups for extracts and
aggregates in the same way lookup registration is done for fields.
Commits on Jan 12, 2014
Reworked custom lookups docs.
Mostly just formatting and rewording, but also replaced the example
using ``YearExtract`` to  use an example which is unlikely to ever be
possible directly in the ORM.
Commits on Jan 14, 2014
Commits on Jan 18, 2014
Fixed removal of signal receivers in Python 3.4
Make use of `weakref.finalize` and `weakref.WeakMethod` on python 3.4.
Simplified the removal of receivers, the old function looked overly
complicated.

Many thanks go to Antoine Pitrou for helping me to debug and explain all
the failures I ran into while writing that patch.
Fixed #21750 -- Fixed regression introduced by 4befb30.
Validating STATIC_ROOT in StaticFilesStorage.__init__ turned out to be
problematic - especially with tests - because the storage refuses to work even
if there are no actual interactions with the file system, which is backward
incompatible.

Originally the validation happened in the StaticFilesStorage.path method, but
that didn't work as expected because the call to FileSystemStorage.__init__
replaced the empty value by a valid path. The new approach is to move back the
check to the StaticFilesStorage.path method, but ensure that the location
attribute remains None after the call to super.

Refs #21581.
Fixed #21547 -- Updated GeoDjango tutorial with PostGIS 2 output
Thanks awilliams at cironline.org for the report.
Fixed #21756 -- Skipped two timezone-related tests on Windows.
Windows cannot use a time zone other than the default time zone.

Thanks manfre for the report.
Fixed a test isolation issue. Refs #17062.
This test could change settings.DATABASES['default']['TIME_ZONE'] and
didn't restore the previous value.
Fixed #21452 -- Non-autocommit connections to PostgreSQL.
When settings.DATABASES['default']['AUTOCOMMIT'] = False, the connection
wasn't in autocommit mode but Django pretended it was.

Thanks Anssi for analysing this issue.

Refs #17062.
Fixed #21453 -- Enabled autocommit before calling init_connection_state.
Also ensured the transaction state is clean on Oracle while I was there.

This change cannot be backported to 1.6 because it's
backwards-incompatible for custom database backends.
Fixed a test that was failing with PostGIS.
Fixed #21452 again.

Forward-port of 18d75e0 from stable/1.6.x.
Used a regular lock for app registry population.
Since the app registry is always populated before the first request is
processed, the situation described in #18251 for the old app cache
cannot happen any more.

Refs #18251, #21628.
Add further workarounds for HTMLParser with Python 3.4.
Python 3.5 will change the default value of convert_charrefs, so 3.4
gives warnings if it's not present. This is slightly technical as 2.7
doesn't have the kwarg. Thankfully, we already have a bunch of
workarounds for different versions.
Undelete the `return True` removed in 4e0a2fe.
This is quite important otherwise we don't close our connections to the
SMTP server.
Remove unneded open(.., 'U') when on python 3.
Universal newlines is enabled by default on py3, and the usage of 'U' is
deprecated in py3.4.
Fixed #21774 -- Isolate all test urls from eachother.
This (nearly) completes the work to isolate all the test modules from
each other. This is now more important as importing models from another
module will case PendingDeprecationWarnings if those modules are not in
INSTALLED_APPS. The only remaining obvious dependencies are:

- d.c.auth depends on d.c.admin (because of the is_admin flag to some
  views), but this is not so important and d.c.admin is in
  always_installed_apps
- test_client_regress depends on test_client. Eventually these should
  become a single module, as the split serves no useful purpose.
Fixed #21768 -- Corrected TemplateView context section.
Thanks nedbatchelder for the report and claudep for the patch.
Fixed #21740 -- Stopped using mutable default arguments in test client
Thanks Denver Coneybeare for the report and initial patch, and
Atala for another patch.
Fixed #20052 -- Discouraged use of Jython given the current state of …
…django-jython.

Thanks Josh Juneau (maintainer of django-jython) for the review.
Showing with 2,380 additions and 1,112 deletions.
  1. +1 −0 MANIFEST.in
  2. +1 −1 django/apps/base.py
  3. +8 −5 django/apps/registry.py
  4. +7 −7 django/contrib/auth/management/__init__.py
  5. +1 −0 django/contrib/auth/tests/test_templates.py
  6. +5 −1 django/contrib/auth/tests/urls.py
  7. +3 −2 django/contrib/contenttypes/generic.py
  8. +4 −4 django/contrib/contenttypes/management.py
  9. +1 −3 django/contrib/gis/db/backends/mysql/operations.py
  10. +1 −4 django/contrib/gis/db/backends/oracle/operations.py
  11. +1 −4 django/contrib/gis/db/backends/postgis/operations.py
  12. +1 −4 django/contrib/gis/db/backends/spatialite/operations.py
  13. +15 −0 django/contrib/gis/db/models/constants.py
  14. +6 −0 django/contrib/gis/db/models/fields.py
  15. +28 −0 django/contrib/gis/db/models/lookups.py
  16. +1 −1 django/contrib/gis/db/models/sql/compiler.py
  17. +1 −13 django/contrib/gis/db/models/sql/query.py
  18. +1 −1 django/contrib/staticfiles/finders.py
  19. +11 −3 django/contrib/staticfiles/storage.py
  20. +1 −0 django/core/mail/backends/smtp.py
  21. +2 −1 django/core/management/__init__.py
  22. +3 −2 django/core/management/commands/makemessages.py
  23. +4 −3 django/core/management/sql.py
  24. +4 −2 django/db/backends/__init__.py
  25. +3 −0 django/db/backends/oracle/base.py
  26. +12 −6 django/db/backends/postgresql_psycopg2/base.py
  27. +5 −0 django/db/backends/sqlite3/base.py
  28. +1 −1 django/db/migrations/questioner.py
  29. +1 −0 django/db/models/__init__.py
  30. +5 −4 django/db/models/aggregates.py
  31. +7 −5 django/db/models/fields/__init__.py
  32. +22 −14 django/db/models/fields/related.py
  33. +317 −0 django/db/models/lookups.py
  34. +2 −2 django/db/models/signals.py
  35. +9 −1 django/db/models/sql/aggregates.py
  36. +46 −32 django/db/models/sql/compiler.py
  37. +16 −7 django/db/models/sql/datastructures.py
  38. +3 −3 django/db/models/sql/expressions.py
  39. +111 −68 django/db/models/sql/query.py
  40. +8 −12 django/db/models/sql/subqueries.py
  41. +18 −9 django/db/models/sql/where.py
  42. +36 −27 django/dispatch/dispatcher.py
  43. +254 −0 django/dispatch/license.python.txt
  44. +0 −261 django/dispatch/saferef.py
  45. +69 −0 django/dispatch/weakref_backports.py
  46. +6 −2 django/forms/fields.py
  47. +1 −1 django/http/response.py
  48. +9 −9 django/test/client.py
  49. +12 −1 django/utils/html_parser.py
  50. +0 −13 django/utils/module_loading.py
  51. +6 −0 docs/howto/custom-model-fields.txt
  52. +11 −64 docs/howto/jython.txt
  53. +2 −1 docs/index.txt
  54. +1 −12 docs/internals/committers.txt
  55. +2 −5 docs/internals/contributing/bugs-and-features.txt
  56. +3 −0 docs/internals/deprecation.txt
  57. +26 −0 docs/misc/design-philosophies.txt
  58. +3 −2 docs/ref/class-based-views/base.txt
  59. +8 −3 docs/ref/contrib/gis/tutorial.txt
  60. +1 −1 docs/ref/files/storage.txt
  61. +6 −0 docs/ref/forms/fields.txt
  62. +336 −0 docs/ref/models/custom-lookups.txt
  63. +7 −0 docs/ref/models/fields.txt
  64. +1 −0 docs/ref/models/index.txt
  65. +4 −0 docs/ref/models/querysets.txt
  66. +6 −2 docs/ref/models/relations.txt
  67. +2 −2 docs/ref/signals.txt
  68. +3 −1 docs/ref/templates/builtins.txt
  69. +33 −0 docs/releases/1.7.txt
  70. +9 −8 docs/topics/auth/default.txt
  71. +4 −0 docs/topics/cache.txt
  72. +4 −1 docs/topics/db/examples/many_to_many.txt
  73. +7 −2 docs/topics/templates.txt
  74. +3 −3 docs/topics/testing/tools.txt
  75. +1 −1 setup.cfg
  76. +6 −4 tests/admin_custom_urls/tests.py
  77. +3 −2 tests/admin_scripts/tests.py
  78. +17 −13 tests/admin_widgets/tests.py
  79. +1 −1 tests/aggregation/tests.py
  80. +29 −10 tests/backends/tests.py
  81. +1 −1 tests/contenttypes_tests/models.py
  82. 0 tests/custom_lookups/__init__.py
  83. +13 −0 tests/custom_lookups/models.py
  84. +279 −0 tests/custom_lookups/tests.py
  85. +0 −76 tests/dispatch/tests/test_saferef.py
  86. +20 −1 tests/expressions/tests.py
  87. +6 −0 tests/field_deconstruction/tests.py
  88. +17 −15 tests/file_uploads/tests.py
  89. +6 −0 tests/forms_tests/tests/test_fields.py
  90. +13 −8 tests/forms_tests/tests/test_widgets.py
  91. +25 −5 tests/mail/tests.py
  92. +3 −3 tests/middleware/extra_urls.py
  93. +12 −11 tests/middleware/tests.py
  94. +3 −3 tests/migrate_signals/tests.py
  95. +6 −0 tests/model_inheritance_regress/tests.py
  96. +0 −3 tests/null_queries/tests.py
  97. +10 −3 tests/queries/tests.py
  98. +2 −2 tests/resolve_url/tests.py
  99. +6 −0 tests/resolve_url/urls.py
  100. +25 −23 tests/template_tests/tests.py
  101. +73 −68 tests/test_client/tests.py
  102. +7 −4 tests/test_client/urls.py
  103. +2 −2 tests/test_client/views.py
  104. +150 −117 tests/test_client_regress/tests.py
  105. +14 −12 tests/test_client_regress/urls.py
  106. +2 −2 tests/test_client_regress/views.py
  107. +6 −31 tests/urls.py
  108. +4 −5 tests/utils_tests/test_dateformat.py
  109. +1 −1 tests/view_tests/models.py
  110. +9 −8 tests/view_tests/tests/test_debug.py
  111. +9 −8 tests/view_tests/tests/test_defaults.py
  112. +18 −15 tests/view_tests/tests/test_i18n.py
  113. +9 −8 tests/view_tests/tests/test_static.py
View
@@ -6,6 +6,7 @@ include MANIFEST.in
include django/contrib/gis/gdal/LICENSE
include django/contrib/gis/geos/LICENSE
include django/dispatch/license.txt
include django/dispatch/license.python.txt
recursive-include docs *
recursive-include scripts *
recursive-include extras *
View
@@ -99,7 +99,7 @@ def create(cls, entry):
raise ImproperlyConfigured(
"'%s' must supply a name attribute." % entry)
# Ensure app_names points to a valid module.
# Ensure app_name points to a valid module.
app_module = import_module(app_name)
# Entry is a path to an app config class.
View
@@ -1,11 +1,11 @@
from collections import Counter, defaultdict, OrderedDict
import os
import sys
import threading
import warnings
from django.core.exceptions import ImproperlyConfigured
from django.utils import lru_cache
from django.utils.module_loading import import_lock
from django.utils._os import upath
from .base import AppConfig
@@ -44,6 +44,9 @@ def __init__(self, installed_apps=()):
# Whether the registry is populated.
self.ready = False
# Lock for thread-safe population.
self._lock = threading.Lock()
# Pending lookups for lazy relations.
self._pending_lookups = {}
@@ -61,10 +64,10 @@ def populate(self, installed_apps=None):
"""
if self.ready:
return
# Since populate() may be a side effect of imports, and since it will
# itself import modules, an ABBA deadlock between threads would be
# possible if we didn't take the import lock. See #18251.
with import_lock():
# populate() might be called by two threads in parallel on servers
# that create threads before initializing the WSGI callable.
with self._lock:
if self.ready:
return
@@ -60,7 +60,7 @@ def _check_permission_clashing(custom, builtin, ctype):
pool.add(codename)
def create_permissions(app_config, verbosity=2, interactive=True, db=DEFAULT_DB_ALIAS, **kwargs):
def create_permissions(app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS, **kwargs):
if not app_config.models_module:
return
@@ -69,7 +69,7 @@ def create_permissions(app_config, verbosity=2, interactive=True, db=DEFAULT_DB_
except LookupError:
return
if not router.allow_migrate(db, Permission):
if not router.allow_migrate(using, Permission):
return
from django.contrib.contenttypes.models import ContentType
@@ -82,15 +82,15 @@ def create_permissions(app_config, verbosity=2, interactive=True, db=DEFAULT_DB_
for klass in app_config.get_models():
# Force looking up the content types in the current database
# before creating foreign keys to them.
ctype = ContentType.objects.db_manager(db).get_for_model(klass)
ctype = ContentType.objects.db_manager(using).get_for_model(klass)
ctypes.add(ctype)
for perm in _get_all_permissions(klass._meta, ctype):
searched_perms.append((ctype, perm))
# Find all the Permissions that have a content_type for a model we're
# looking for. We don't need to check for codenames since we already have
# a list of the ones we're going to create.
all_perms = set(Permission.objects.using(db).filter(
all_perms = set(Permission.objects.using(using).filter(
content_type__in=ctypes,
).values_list(
"content_type", "codename"
@@ -113,13 +113,13 @@ def create_permissions(app_config, verbosity=2, interactive=True, db=DEFAULT_DB_
verbose_name_max_length,
)
)
Permission.objects.using(db).bulk_create(perms)
Permission.objects.using(using).bulk_create(perms)
if verbosity >= 2:
for perm in perms:
print("Adding permission '%s'" % perm)
def create_superuser(app_config, verbosity=2, interactive=True, db=DEFAULT_DB_ALIAS, **kwargs):
def create_superuser(app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS, **kwargs):
try:
apps.get_model('auth', 'Permission')
except LookupError:
@@ -139,7 +139,7 @@ def create_superuser(app_config, verbosity=2, interactive=True, db=DEFAULT_DB_AL
confirm = input('Please enter either "yes" or "no": ')
continue
if confirm == 'yes':
call_command("createsuperuser", interactive=True, database=db)
call_command("createsuperuser", interactive=True, database=using)
break
@@ -17,6 +17,7 @@
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
)
class AuthTemplateTests(TestCase):
urls = 'django.contrib.auth.tests.urls'
def test_titles(self):
rf = RequestFactory()
@@ -1,4 +1,5 @@
from django.conf.urls import patterns, url
from django.conf.urls import patterns, url, include
from django.contrib import admin
from django.contrib.auth import context_processors
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.urls import urlpatterns
@@ -98,4 +99,7 @@ def custom_request_auth_login(request):
(r'^auth_processor_messages/$', auth_processor_messages),
(r'^custom_request_auth_login/$', custom_request_auth_login),
url(r'^userpage/(.+)/$', userpage, name="userpage"),
# This line is only required to render the password reset with is_admin=True
(r'^admin/', include(admin.site.urls)),
)
@@ -12,7 +12,7 @@
from django.db.models import signals
from django.db.models.fields.related import ForeignObject, ForeignObjectRel
from django.db.models.related import PathInfo
from django.db.models.sql.where import Constraint
from django.db.models.sql.datastructures import Col
from django.forms import ModelForm, ALL_FIELDS
from django.forms.models import (BaseModelFormSet, modelformset_factory,
modelform_defines_fields)
@@ -236,7 +236,8 @@ def get_extra_restriction(self, where_class, alias, remote_alias):
field = self.rel.to._meta.get_field_by_name(self.content_type_field_name)[0]
contenttype_pk = self.get_content_type().pk
cond = where_class()
cond.add((Constraint(remote_alias, field.column, field), 'exact', contenttype_pk), 'AND')
lookup = field.get_lookup('exact')(Col(remote_alias, field, field), contenttype_pk)
cond.add(lookup, 'AND')
return cond
def bulk_related_objects(self, objs, using=DEFAULT_DB_ALIAS):
@@ -6,7 +6,7 @@
from django.utils.six.moves import input
def update_contenttypes(app_config, verbosity=2, interactive=True, db=DEFAULT_DB_ALIAS, **kwargs):
def update_contenttypes(app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS, **kwargs):
"""
Creates content types for models in the given app, removing any model
entries that no longer have a matching model class.
@@ -19,7 +19,7 @@ def update_contenttypes(app_config, verbosity=2, interactive=True, db=DEFAULT_DB
except LookupError:
return
if not router.allow_migrate(db, ContentType):
if not router.allow_migrate(using, ContentType):
return
ContentType.objects.clear_cache()
@@ -36,7 +36,7 @@ def update_contenttypes(app_config, verbosity=2, interactive=True, db=DEFAULT_DB
# Get all the content types
content_types = dict(
(ct.model, ct)
for ct in ContentType.objects.using(db).filter(app_label=app_label)
for ct in ContentType.objects.using(using).filter(app_label=app_label)
)
to_remove = [
ct
@@ -53,7 +53,7 @@ def update_contenttypes(app_config, verbosity=2, interactive=True, db=DEFAULT_DB
for (model_name, model) in six.iteritems(app_models)
if model_name not in content_types
]
ContentType.objects.using(db).bulk_create(cts)
ContentType.objects.using(using).bulk_create(cts)
if verbosity >= 2:
for ct in cts:
print("Adding content type '%s | %s'" % (ct.app_label, ct.model))
@@ -49,9 +49,7 @@ def get_geom_placeholder(self, value, srid):
return placeholder
def spatial_lookup_sql(self, lvalue, lookup_type, value, field, qn):
alias, col, db_type = lvalue
geo_col = '%s.%s' % (qn(alias), qn(col))
geo_col, db_type = lvalue
lookup_info = self.geometry_functions.get(lookup_type, False)
if lookup_info:
@@ -231,10 +231,7 @@ def transform_value(val, srid):
def spatial_lookup_sql(self, lvalue, lookup_type, value, field, qn):
"Returns the SQL WHERE clause for use in Oracle spatial SQL construction."
alias, col, db_type = lvalue
# Getting the quoted table name as `geo_col`.
geo_col = '%s.%s' % (qn(alias), qn(col))
geo_col, db_type = lvalue
# See if a Oracle Geometry function matches the lookup type next
lookup_info = self.geometry_functions.get(lookup_type, False)
@@ -478,10 +478,7 @@ def spatial_lookup_sql(self, lvalue, lookup_type, value, field, qn):
(alias, col, db_type), the lookup type string, lookup value, and
the geometry field.
"""
alias, col, db_type = lvalue
# Getting the quoted geometry column.
geo_col = '%s.%s' % (qn(alias), qn(col))
geo_col, db_type = lvalue
if lookup_type in self.geometry_operators:
if field.geography and not lookup_type in self.geography_operators:
@@ -324,10 +324,7 @@ def spatial_lookup_sql(self, lvalue, lookup_type, value, field, qn):
[a tuple of (alias, column, db_type)], lookup type, lookup
value, the model field, and the quoting function.
"""
alias, col, db_type = lvalue
# Getting the quoted field as `geo_col`.
geo_col = '%s.%s' % (qn(alias), qn(col))
geo_col, db_type = lvalue
if lookup_type in self.geometry_functions:
# See if a SpatiaLite geometry function matches the lookup type.
@@ -0,0 +1,15 @@
from django.db.models.sql.constants import QUERY_TERMS
GIS_LOOKUPS = {
'bbcontains', 'bboverlaps', 'contained', 'contains',
'contains_properly', 'coveredby', 'covers', 'crosses', 'disjoint',
'distance_gt', 'distance_gte', 'distance_lt', 'distance_lte',
'dwithin', 'equals', 'exact',
'intersects', 'overlaps', 'relate', 'same_as', 'touches', 'within',
'left', 'right', 'overlaps_left', 'overlaps_right',
'overlaps_above', 'overlaps_below',
'strictly_above', 'strictly_below'
}
ALL_TERMS = GIS_LOOKUPS | QUERY_TERMS
__all__ = ['ALL_TERMS', 'GIS_LOOKUPS']
@@ -2,6 +2,8 @@
from django.db.models.sql.expressions import SQLEvaluator
from django.utils.translation import ugettext_lazy as _
from django.contrib.gis import forms
from django.contrib.gis.db.models.constants import GIS_LOOKUPS
from django.contrib.gis.db.models.lookups import GISLookup
from django.contrib.gis.db.models.proxy import GeometryProxy
from django.contrib.gis.geometry.backend import Geometry, GeometryException
from django.utils import six
@@ -284,6 +286,10 @@ def get_placeholder(self, value, connection):
"""
return connection.ops.get_geom_placeholder(self, value)
for lookup_name in GIS_LOOKUPS:
lookup = type(lookup_name, (GISLookup,), {'lookup_name': lookup_name})
GeometryField.register_lookup(lookup)
# The OpenGIS Geometry Type Fields
class PointField(GeometryField):
@@ -0,0 +1,28 @@
from django.db.models.lookups import Lookup
from django.db.models.sql.expressions import SQLEvaluator
class GISLookup(Lookup):
def as_sql(self, qn, connection):
from django.contrib.gis.db.models.sql import GeoWhereNode
# We use the same approach as was used by GeoWhereNode. It would
# be a good idea to upgrade GIS to use similar code that is used
# for other lookups.
if isinstance(self.rhs, SQLEvaluator):
# Make sure the F Expression destination field exists, and
# set an `srid` attribute with the same as that of the
# destination.
geo_fld = GeoWhereNode._check_geo_field(self.rhs.opts, self.rhs.expression.name)
if not geo_fld:
raise ValueError('No geographic field found in expression.')
self.rhs.srid = geo_fld.srid
db_type = self.lhs.output_type.db_type(connection=connection)
params = self.lhs.output_type.get_db_prep_lookup(
self.lookup_name, self.rhs, connection=connection)
lhs_sql, lhs_params = self.process_lhs(qn, connection)
# lhs_params not currently supported.
assert not lhs_params
data = (lhs_sql, db_type)
spatial_sql, spatial_params = connection.ops.spatial_lookup_sql(
data, self.lookup_name, self.rhs, self.lhs.output_type, qn)
return spatial_sql, spatial_params + params
@@ -133,7 +133,7 @@ def get_default_columns(self, with_aliases=False, col_aliases=None,
if table in only_load and field.column not in only_load[table]:
continue
if as_pairs:
result.append((alias, field.column))
result.append((alias, field))
aliases.add(alias)
continue
# This part of the function is customized for GeoQuery. We
@@ -1,6 +1,7 @@
from django.db import connections
from django.db.models.query import sql
from django.contrib.gis.db.models.constants import ALL_TERMS
from django.contrib.gis.db.models.fields import GeometryField
from django.contrib.gis.db.models.sql import aggregates as gis_aggregates
from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, GeomField
@@ -9,19 +10,6 @@
from django.contrib.gis.measure import Area, Distance
ALL_TERMS = set([
'bbcontains', 'bboverlaps', 'contained', 'contains',
'contains_properly', 'coveredby', 'covers', 'crosses', 'disjoint',
'distance_gt', 'distance_gte', 'distance_lt', 'distance_lte',
'dwithin', 'equals', 'exact',
'intersects', 'overlaps', 'relate', 'same_as', 'touches', 'within',
'left', 'right', 'overlaps_left', 'overlaps_right',
'overlaps_above', 'overlaps_below',
'strictly_above', 'strictly_below'
])
ALL_TERMS.update(sql.constants.QUERY_TERMS)
class GeoQuery(sql.Query):
"""
A single spatial SQL query.
@@ -57,7 +57,7 @@ def __init__(self, app_names=None, *args, **kwargs):
prefix, root = root
else:
prefix = ''
if os.path.abspath(settings.STATIC_ROOT) == os.path.abspath(root):
if settings.STATIC_ROOT and os.path.abspath(settings.STATIC_ROOT) == os.path.abspath(root):
raise ImproperlyConfigured(
"The STATICFILES_DIRS setting should "
"not contain the STATIC_ROOT setting")
@@ -32,13 +32,21 @@ def __init__(self, location=None, base_url=None, *args, **kwargs):
location = settings.STATIC_ROOT
if base_url is None:
base_url = settings.STATIC_URL
check_settings(base_url)
super(StaticFilesStorage, self).__init__(location, base_url,
*args, **kwargs)
# FileSystemStorage fallbacks to MEDIA_ROOT when location
# is empty, so we restore the empty value.
if not location:
self.base_location = None
self.location = None
def path(self, name):
if not self.location:
raise ImproperlyConfigured("You're using the staticfiles app "
"without having set the STATIC_ROOT "
"setting to a filesystem path.")
check_settings(base_url)
super(StaticFilesStorage, self).__init__(location, base_url,
*args, **kwargs)
return super(StaticFilesStorage, self).path(name)
class CachedFilesMixin(object):
@@ -57,6 +57,7 @@ def open(self):
self.connection.ehlo()
if self.username and self.password:
self.connection.login(self.username, self.password)
return True
except smtplib.SMTPException:
if not self.fail_silently:
raise
Oops, something went wrong.

No commit comments for this range