Commit Graph

10871 Commits

Author SHA1 Message Date
Ramiro Morales a9b7f31bfc Completed long overdue sqlinitialdata deprecation. 2014-05-11 23:15:59 -03:00
Matt Robenolt 393c0e2422 Fixed #20936 -- When logging out/ending a session, don't create a new, empty session.
Previously, when logging out, the existing session was overwritten by a
new sessionid instead of deleting the session altogether.

This behavior added overhead by creating a new session record in
whichever backend was in use: db, cache, etc.

This extra session is unnecessary at the time since no session data is
meant to be preserved when explicitly logging out.
2014-05-11 21:42:26 -03:00
Rainer Koirikivi a75324c654 Fixed #14226 -- Dependency calculation for complex M2M relations.
`sort_dependencies` incorrectly interpreted 'complex' M2M relations
(with explicit through models) as dependencies for a model. This caused
circular complex M2M relations to be unserializable by dumpdata.

Thanks to aneil for the report and outofculture for initial tests.
2014-05-11 19:50:01 -03:00
Claude Paroz 4cf82e5bcf Fixed #21685 -- Displayed app verbose name in admindocs model index 2014-05-10 18:09:07 +02:00
Aymeric Augustin f574220f09 Fixed #22508 -- Avoided overwriting select_related.
Previously, known related objects overwrote related objects loaded
though select_related. This could cancel the effect of select_related
when it was used over more than one level.

Thanks boxm for the bug report and timo for bisecting the regression.
2014-05-10 16:39:20 +02:00
Aymeric Augustin fb90b7cda2 Adjusted refactoring of vendor checks.
Thanks Shai for the thorough review.
2014-05-10 14:40:42 +02:00
Stephen Burrows a5de0df58b Fixed #22502 -- Fixed microseconds/default/form interaction
Made explicit lack of microsecond handling by built-in datetime form
fields. Used that explicitness to appropriately nix microsecond
values in bound fields. Thanks Claude Paroz for the review.
2014-05-10 10:56:39 +02:00
Malcolm Box 66880e4cd1 Fixed #22606 -- Locmemcache has_key() failed for infinite cache expiry
Refactored cache expiry logic for Locmemcache to make consistent across
all places where accessed, and correctly handle None as expiry time.
2014-05-09 18:35:07 +02:00
Andrew Godwin 5400b29ebf Fixed #22325: Ignore __first__ dependencies to your own app 2014-05-08 21:38:56 -07:00
Andrew Godwin 5182efce8d Fixed #22563: Ignore AUTH_USER_MODEL errors in from_state 2014-05-08 21:34:30 -07:00
David Szotten 7fe60ae64a Fixed #22588 -- Fix RegexValidator __eq__
Compare parameters instead of re.pattern instances, and add the other
parameters to the comparison. Also add a __ne__ to make assertNotEqual
work properly.
2014-05-08 19:51:15 -07:00
Aymeric Augustin 99d9fa329a Added feature flags for introspection capabilities. 2014-05-08 22:11:20 +02:00
Aymeric Augustin cff59bedc2 Split ignores_nulls_in_unique_constraints feature.
Oracle and SQL Server don't have exactly the same limitations. It's
worth treating them differently.
2014-05-08 22:11:20 +02:00
Aymeric Augustin c70a61eb49 Replaced vendor checks by three feature flags. 2014-05-08 22:11:15 +02:00
Aymeric Augustin b1432bfc22 Appeased flake8. 2014-05-08 21:49:54 +02:00
Claude Paroz fc32e9c0d9 Removed unused imports in makemigrations 2014-05-08 19:39:43 +02:00
Andrew Godwin b25aee3b7b Fixed #22476: Couldn't alter attributes on M2Ms with through= set 2014-05-08 10:34:24 -07:00
Ramiro Morales 5ea34f3f86 Restored site header text in password reset view.
It's the one shown when the optional integration described in
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-a-password-reset-feature
is used.

Follow-up to commits 6f470650d0 and 1d42a86ec7, together they fix
different small UI regressions after a962286b74.

Refs #21293.
2014-05-07 23:12:58 -03:00
Andrew Godwin 5a917cfef3 Fixed #22496: Data migrations get transactions again! 2014-05-07 14:28:34 -07:00
Andrew Godwin e9a456d11b Fixed #22581: Pass default values for schema through get_db_prep_save() 2014-05-07 13:46:23 -07:00
Andrew Godwin fc974313b8 Fixed #22563: Better error message when trying to change AUTH_USER_MODEL
You're not allowed to do this after you've made migrations; see ticket
for more details.
2014-05-07 13:05:11 -07:00
Andrew Godwin f9d7e18dc5 Fixed #22576: Ensure makemigrations doesn't touch the database. 2014-05-06 22:41:59 -07:00
Andrew Godwin 6944418277 Fixed #22337: FileSystemStorage marked as deconstructible and tested. 2014-05-06 22:23:23 -07:00
Tim Graham 4492ea5475 Fixed #22586 -- Added LANGUAGE_SESSION_KEY to __all__.
Thanks david.fischer.ch at gmail.com for the report.
2014-05-06 19:47:22 -04:00
Claude Paroz da9cf53cb5 Fixed #22564 -- Prevented unneeded bytestrings in migrations
In some cases, this could lead to migrations written with Python 2
being incompatible with Python 3.
Thanks Tim Graham for the report and Loïc Bistuer for the advices.
2014-05-06 09:13:07 +02:00
Claude Paroz 12474dacef Added a bunch of missing unicode_literals
Refs #22564.
2014-05-06 09:13:07 +02:00
Ben Davis df60db0e78 Fixed #22570 -- Made Form.__getitem__ KeyError more descriptive. 2014-05-05 20:01:15 -04:00
Loic Bistuer 942556df2f Fixed #22572 -- override_settings(ROOT_URLCONF) didn't clear urlresolvers._urlconfs.
Thanks Anubhav Joshi and Tim Graham for the reviews.
2014-05-05 19:29:27 +07:00
Anssi Kääriäinen 3b7c66a3ac Fixed #22466 -- ordering by reverse foreign key
Ordering by reverse foreign key was broken by custom lookups patch
(commit 20bab2cf9d).

Thanks to everybody who helped solving this issue. Special thanks to
Trac alias takis for reporting this.
2014-05-05 15:28:07 +03:00
Jakub Roztocil 7131e14d00 Fixed #22489 -- missing implemenation for search lookup
When custom lookups were added, converting the search lookup to use
the new Lookup infrastructure wasn't done.

Some changes were needed to the added test, main change done by
committer was ensuring the test works on MySQL versions prior to 5.6.
2014-05-05 14:36:15 +03:00
Anssi Kääriäinen 5e1f4656b9 Fixed #22429 -- Incorrect SQL when using ~Q and F 2014-05-05 13:02:11 +03:00
Claude Paroz faa8c71fd9 Moved misplaced transaction.atomic from 0dce44e16b
Thanks Florian Apolloner for noticing the issue and Aymeric
Augustin for the expertise.
Refs #22540.
2014-05-03 23:44:40 +02:00
Tim Graham 3818d96426 Fixed #22435 -- Prevented adding a ManyToManyField from prompting for a default.
Thanks andrewsg for the report.
2014-05-02 20:46:47 -04:00
Claude Paroz 142c27218a Fixed #22565 -- Prevented pgettext_lazy crash with bytestring input
Thanks ygbo for the report.
2014-05-02 19:33:22 +02:00
Loic Bistuer d1799233f4 Fixed clash caused by the newly introduced -e shorthand for makemessages --exclude.
This fixes a regression caused by 0707b82. Refs #22328.
2014-05-02 23:07:17 +07:00
Claude Paroz 0dce44e16b Fixed #22540 -- Made _create_object_from_params() call create()
So as the save step is centralized in create(), especially useful
when customizing behavior in subclasses.
Thanks craig.labenz@gmail.com for the report.
2014-05-02 09:06:15 +02:00
Chris Beaven a0c4b8465d Fix migration autodector to work correctly with custom deconstructed values 2014-05-02 15:08:19 +12:00
Yehonatan Daniv e2e4cdba11 Fixed #22539 -- Copied exclude argument in Model.full_clean() to prevent side effects. 2014-05-01 09:28:11 -04:00
Tim Graham 45c2d1f5d9 flake8 fixes. 2014-04-30 18:33:46 -04:00
Andrew Godwin e049c88603 Cleanup failing test w/contenttypes and remove useless graph load 2014-04-30 15:11:52 -07:00
Andrew Godwin 8f6dff372b Fixed #22485: Include all unmigrated apps in project state by default. 2014-04-30 12:25:12 -07:00
Simon Charette 24ec9538b7 Fixed #19195 -- Allow explicit ordering by a relation `_id` field.
Thanks to chrisedgemon for the report and shaib, akaariai and
timgraham for the review.
2014-04-30 14:23:19 -04:00
Doug Beck a5f6cbce07 Refactored DjangoTranslation class
Also fixes #18192 and #21055.
2014-04-30 18:36:25 +02:00
Claude Paroz 7c54f8cced Fixed #22474 -- Made migration recorder aware of multiple databases
Thanks Tim Graham for the review.
2014-04-30 16:53:20 +02:00
Tim Graham d9c272b22f Removed unused import. 2014-04-30 07:23:39 -04:00
Bruno Ribeiro da Silva 83413c53d2 Fixed #22511 -- Added args to migrations management commands. 2014-04-30 07:15:03 -04:00
Simon Charette a2340ac6d6 Use the new implementation of `six.with_metaclass`.
No more `NewBase` horrors.

Thanks to bendavis78 for his work on merging this into six.
2014-04-29 09:43:08 -04:00
Ramiro Morales 2df7238512 Removed bogus, ineffective 'U' flag from codecs.open() call. 2014-04-29 07:46:54 -03:00
Tim Graham aabceadd7d Revert "Fixed #15179 -- middlewares not applied for test client login()"
This reverts commit 4fdd51b732.

See the ticket for concerns with this implementation; it will be revisited.
2014-04-28 18:41:36 -04:00
Alex Gaynor 2bcb8bfc8d Fix many many typos in comments throughout the codebase 2014-04-26 10:18:45 -07:00
Aymeric Augustin 8b5b199e20 Fixed #3214 -- Stopped parsing SQL with regex.
Avoided introducing a new regex-based SQL splitter in the migrations
framework, before we're bound by backwards compatibility.

Adapted this change to the legacy "initial SQL data" feature, even
though it's already deprecated, in order to facilitate the transition
to migrations.

sqlparse becomes mandatory for RunSQL on some databases (all but
PostgreSQL). There's no API to provide a single statement and tell
Django not to attempt splitting. Since we have a more robust splitting
implementation, that seems like a good tradeoff. It's easier to add a
new keyword argument later if necessary than to remove one.

Many people contributed to both tickets, thank you all, and especially
Claude for the review.

Refs #22401.
2014-04-26 17:46:23 +02:00
Ana Krivokapic 0707b824fe Fixed #22328 -- Added --exclude option to compilemessages and makemessages. 2014-04-26 17:07:44 +07:00
Aymeric Augustin 3033a7193a Fixed #21166 -- Reset errors_occurred flag after commit and rollback. 2014-04-25 22:45:11 +02:00
Tim Graham 9e7f86b890 Fixed #22515 -- Fixed the object_id of the LogEntry that's created after a user password change in the admin.
Thanks ross at servercode.co.uk for the report.
2014-04-25 08:20:25 -04:00
Aymeric Augustin e368912902 Set some transaction-related feature flags on SQLite.
Refs #22496.
2014-04-25 11:43:20 +02:00
Shai Berger 843613add4 Fixed #22498 -- constraint name was not quoted in FK creation SQL 2014-04-25 01:30:43 +03:00
Shai Berger 53d97e4fe3 Made sure cursor.close() does not complain if cursor is already closed on Oracle
Refs #22483
2014-04-25 00:36:40 +03:00
Aymeric Augustin 25209715d4 Prevented a crash in the cursor wrappers on Oracle.
Fixed #22483 (again).

Forwardport of 5cd6429620 from stable/1.7.x
2014-04-24 09:14:42 -04:00
Aymeric Augustin b0f4eecfa7 Ignored repeated calls to connection.close().
Forwardport of 9bbb43dd1a from stable/1.7.x
2014-04-24 09:14:26 -04:00
Kevin Christopher Henry 91afc00513 Fixed #21157 -- Fixed problems with ResolverMatch
- Fixed bug in get_callable() that caused resolve() to put a string
  in ResolverMatch.func.
- Made ResolverMatch.url_name match the actual url name (or None).
- Updated tests that used the string value in ResolverMatch.func, and
  added regression tests for this bug.
- Corrected test urls whose dummy view paths caused failures (behavior
  that was previously masked by this bug).
2014-04-23 20:12:34 -04:00
Aymeric Augustin 0aa4c6c391 Used the same instance of atomic for entry and exit.
Since all state is maintained on the connection at this time and none in
the atomic, it doesn't matter, but it could introduce some subtle bugs
if the implementation changed in the future.
2014-04-23 21:44:36 +02:00
Aymeric Augustin e74d2183c2 Wrapped migrations in a transaction only on DBs with transactional DDL. 2014-04-23 21:44:36 +02:00
Claude Paroz 3a435a057c Set compile messages options as class variable
Refs #18714. Same logic as options for makemessages commands.
2014-04-23 15:15:03 +02:00
Malcolm Box af5f688392 Fixed #22495 -- Locmem cache.add() failed with infinite timeouts
cache.add() incorrectly succeeded when there was an existing key
with an infinite (None) timeout.
2014-04-23 14:49:46 +02:00
Claude Paroz 2ffa6ca73a Added Spatialite support to the new migration framework
Refs #22451.
2014-04-23 13:46:11 +02:00
Claude Paroz 48c4ea4146 Used migration framework in GIS test tearDown 2014-04-23 13:45:41 +02:00
Preston Timmons 3c06b2f2a3 Fixed #22486 -- Restored the ability to reverse views created using functools.partial.
Regression in 8b93b31487.

Thanks rcoup for the report.
2014-04-23 07:27:52 -04:00
Alex Gaynor 58176dee88 Use the stdlib's compare_digest for constant time comparisons when available 2014-04-22 14:45:00 -07:00
Florian Apolloner f286721f7f Fixed #22426 -- Added support old-style d.c.messages format.
Forward ported code from 1.5 that adds backwards compatibility with legacy message length.
See commit 9e7183073f for details.

Thanks to Ofir Ovadia for the initial patch.
2014-04-22 10:46:18 +02:00
Erik Romijn 75c0d4ea3a Fixed queries that may return unexpected results on MySQL due to typecasting.
This is a security fix; disclosure to follow shortly.
2014-04-21 18:11:26 -04:00
Aymeric Augustin c083e3815a Prevented leaking the CSRF token through caching.
This is a security fix. Disclosure will follow shortly.
2014-04-21 18:11:26 -04:00
Tim Graham 8b93b31487 Fixed a remote code execution vulnerabilty in URL reversing.
Thanks Benjamin Bach for the report and initial patch.

This is a security fix; disclosure to follow shortly.
2014-04-21 18:11:26 -04:00
Claude Paroz ab90c4707b Fixed table cleanup in GIS migration tests 2014-04-21 23:08:00 +02:00
Claude Paroz 1667e736a7 Fixed PostGIS remove_field implementation
Fixed bad code introduced in 2f9d1576e8.
2014-04-21 22:42:11 +02:00
Claude Paroz 2f9d1576e8 Fixed removal of GIS column in PostGIS 1.x migration
Refs #22481.
2014-04-21 21:17:14 +02:00
Claude Paroz fb09a489ca Fixed adding new GIS column in PostGIS 1.x migration
Refs #22451.
2014-04-21 20:58:09 +02:00
Florian Apolloner 405b13fe83 Fixed migrate when called inside a transaction.
This is useful for tests manually calling migrate inside a testcase,
for normal usage this should make no difference, since there is no
surrounding transaction after all. If there is one we still try to
leave the transaction in a useable state (for postgres at least).

If this commit turns out to be causing issues, settings savepoint=False
is probably the right fix :)
2014-04-21 15:37:12 +02:00
Aymeric Augustin 428c0bbe1b Appeased flake8 2.1.0. 2014-04-21 12:27:34 +02:00
Tim Graham 471fb04a30 Fixed flake8 errors. 2014-04-20 13:08:04 -04:00
Andrew Gorcester 956bd64424 Fixed #22397 -- Issues removing M2M field with explicit through model
Changed the migration autodetector to remove models last so that FK
and M2M fields will not be left as dangling references. Added a check
in the migration state renderer to error out in the presence of
dangling references instead of leaving them as strings. Fixed a bug
in the sqlite backend to handle the deletion of M2M fields with
"through" models properly (i.e., do nothing successfully).

Thanks to melinath for report, loic for tests and andrewgodwin and
charettes for assistance with architecture.
2014-04-18 16:44:47 -04:00
Claude Paroz 275811a93c Adapted fixture read mode to file type
Binary mode added in ed532a6a1e is not supported by ZipFile.
Refs #22399.
2014-04-18 18:54:46 +02:00
Claude Paroz ed532a6a1e Fixed #22399 -- Forced fixture reading in binary mode
This might help on systems where default encoding is not UTF-8 (and
on Python 3).
Thanks bacilla for the report.
2014-04-18 17:55:35 +02:00
amatellanes 8394e570ba Fixed #22465 -- New assertion assertJSONNotEqual 2014-04-18 15:11:08 +07:00
Simon Charette 0d397e5a5b Revert "Fixed #22397 -- Issues removing M2M field with explicit through model."
This reverts commit 00e3b9a2a9.

It's causing a regression when tested with the proxy_model_inheritance tests.
2014-04-18 01:27:30 -04:00
Moayad Mardini 214d1e1b0f Fixed #22454 - Changed compatibility warning hint
The warning hint of `_check_test_runner` of 1.6 compatibility had a link
to a general release note. The link should be edited to refer the
relevant "Backwards incompatible changes in 1.6" section that documents
the cause and the possible solutions and workarounds of the warning.
2014-04-17 20:41:25 -04:00
Tim Graham 11e30b684d Fixed a KeyError on login with legacy sessions; refs #21649.
Thanks Loic for the report.
2014-04-17 19:57:20 -04:00
Donald Stufft ecff136f69 Merge pull request #2582 from alex/stdlib-pbkdf2hmac
Use the stdlib's PBKDF2 implementation when available.
2014-04-17 16:01:17 -04:00
Claude Paroz c082f3c74c Fixed #22456 -- Replaced 900913 EPSG code by 3857 in some tests
3857 is now the official EPSG code for the Google spherical mercator
projection and some recent versions of GDAL do not recognize 900913
any longer.
Thanks Tim Graham for the report and initial patch.
2014-04-17 21:18:07 +02:00
Alex Gaynor 7283c21173 For another day 2014-04-17 11:07:19 -07:00
Alex Gaynor 21a1fddcc4 Typo fix 2014-04-17 11:04:57 -07:00
Alex Gaynor cb68eb3e6d Use the stdlib's PBKDF2 implementation when available.
This is a bit faster than ours, which is good, because it lets you increase
the iteration counts.

This will be used on Python 3.4+, and, pending the acceptance of PEP466, on
newer Python 2.7s.
2014-04-17 11:02:42 -07:00
Andrew Gorcester 00e3b9a2a9 Fixed #22397 -- Issues removing M2M field with explicit through model.
Changed the migration autodetector to remove models last so that FK
and M2M fields will not be left as dangling references. Added a check
in the migration state renderer to error out in the presence of
dangling references instead of leaving them as strings. Fixed a bug
in the sqlite backend to handle the deletion of M2M fields with
"through" models properly (i.e., do nothing successfully).

Thanks to melinath for report, loic for tests and andrewgodwin and
charettes for assistance with architecture.
2014-04-17 12:54:35 -04:00
Tim Graham 47927eb786 Revert "Fixed #22401 -- Deprecated regular expression parsing of initial SQL in favor of installing sqlparse."
This reverts commit 071c933775.

This introduced a regression on MySQL and custom SQL is deprecated.
2014-04-16 21:03:22 -04:00
Justin Hamade a13df671a5 Fixed #22434 -- Retain ordering on related sliced subqueries.
Thanks maciej.pawlisz for the report, and charettes for the review.
2014-04-16 17:57:11 -04:00
Simon Charette 79f05616fb Fixed flake8 warnings introduced in recent commits. 2014-04-16 16:49:37 -04:00
Motiejus Jakštys 0e45669fa9 Fixed #22460 -- Explicity remove constraints when dropping a related field. 2014-04-16 15:38:31 -04:00
Marc Egli 0bcc92c691 Fixed #22356 -- Added a check to make sure unique_together fields are local. 2014-04-14 16:49:40 -04:00
Jacob R. Rothenbuhler 17c1884456 Fixed #22369 -- Added count parameter to assertTemplateUsed 2014-04-14 15:55:10 -04:00
Simon Charette 72d3889db4 Fixed #22350 -- Consistently serialize bytes and text in migrations.
Thanks to @treyhunner and Loïc for their suggestions and review.
2014-04-13 18:22:26 -04:00
valtron d3b71b976d Fixed #21760 -- prefetch_related used an inefficient query for reverse FK.
Regression introduced by commit 9777442. Refs #21410.
2014-04-13 00:34:16 +07:00