Commit Graph

1353 Commits

Author SHA1 Message Date
Andrew Godwin d3d1e59921 Add a SQlite backend. One test passes! 2012-08-18 14:16:52 +01:00
Andrew Godwin f7955c703d All tests passing on MySQL 2012-08-18 13:48:54 +01:00
Andrew Godwin cab044c66c First stab at MySQL support 2012-08-18 12:29:31 +01:00
Andrew Godwin 60873ea2ad Add db_table and db_tablespace handling 2012-08-10 15:03:18 +01:00
Andrew Godwin 184cf9ab79 Merge branch 'master' into schema-alteration 2012-08-10 12:40:37 +01:00
Andrew Godwin c4b2a3262c Add support for unique_together 2012-08-10 12:38:18 +01:00
Aymeric Augustin 5c09c59bc7 [py3] Renamed `next` to `__next__` in iterators.
See PEP 3114. `next` is retained as an alias for Python 2.
2012-08-09 14:36:05 +02:00
Claude Paroz b8e49d70f2 [py3] Replaced raw_input by input
The six addition has been borrowed from:
https://bitbucket.org/gutworth/six/changeset/733ef740
2012-08-08 19:53:11 +02:00
Alex Gaynor 4c97101b1f remove a bunch of unnescesarry iterkeys() calls 2012-08-08 07:33:15 -07:00
Claude Paroz 576ec12f8e [py3] Replaced __nonzero__ by __bool__
Of course, __nonzero__ alias has been kept for Python 2 compatibility.
2012-08-08 15:02:31 +02:00
Aymeric Augustin 12cda89ffe [py3] Fixed a loop that changed dictionary size. 2012-08-08 15:00:24 +02:00
Aymeric Augustin a8b3ddec5f [py3] Applied minor fixes so the test suite starts 2012-08-07 12:00:22 +02:00
Aymeric Augustin c5ef65bcf3 [py3] Ported django.utils.encoding.
* Renamed smart_unicode to smart_text (but kept the old name under
  Python 2 for backwards compatibility).
* Renamed smart_str to smart_bytes.
* Re-introduced smart_str as an alias for smart_text under Python 3
  and smart_bytes under Python 2 (which is backwards compatible).
  Thus smart_str always returns a str objects.
* Used the new smart_str in a few places where both Python 2 and 3
  want a str.
2012-08-07 12:00:22 +02:00
Aymeric Augustin ee191715ea [py3] Fixed access to dict keys/values/items. 2012-08-07 12:00:22 +02:00
Brendan MacDonell ad237fb72f Fixed #18724 -- Fixed IntegerField validation with value 0 2012-08-06 10:42:21 +02:00
Claude Paroz 9908201d7f Replaced some byte strings by str() calls
This is a useful trick when Python 2 awaits byte strings and
Python 3 Unicode (regular) strings.
2012-08-03 15:18:13 +02:00
Andrew Godwin b139315f1c Add M2M tests and some unique support 2012-08-02 15:08:39 +01:00
Andrew Godwin 4a2e80fff4 Merge branch 'master' of github.com:django/django into schema-alteration
Conflicts:
	django/db/backends/postgresql_psycopg2/base.py
2012-07-26 18:58:10 +01:00
Ramiro Morales f758bdab5e Fixed #18271 -- Changed stage at which TransactionTestCase flushes DB tables.
Previously, the flush was done before the test case execution and now
it is performed after it.

Other changes to the testing infrastructure include:

* TransactionTestCase now doesn't reset autoincrement sequences either
  (previous behavior can achieved by using `reset_sequences`.)
  With this, no implicit such reset is performed by any of the provided
  TestCase classes.

* New ordering of test cases: All unittest tes cases are run first and
  doctests are run at the end.

THse changes could be backward-incompatible with test cases that relied
on some kind of state being preserved between tests. Please read the
relevant sections of the release notes and testing documentation for
further details.

Thanks Andreas Pelme for the initial patch. Karen Tracey and Anssi
Kääriäinen for the feedback and Anssi for reviewing.

This also fixes #12408.
2012-07-24 17:24:16 -03:00
Aymeric Augustin ae4125ffce Removed a Python 3-compatibility hack.
Thanks Preston Holmes for the patch.
2012-07-23 13:48:04 +02:00
Aymeric Augustin a84d79f572 [py3] Added Python 3 compatibility for xrange. 2012-07-22 09:29:56 +02:00
Aymeric Augustin ca07fda2ef [py3] Switched to Python 3-compatible imports.
xrange/range will be dealt with in a separate commit due to the huge
number of changes.
2012-07-22 09:29:56 +02:00
Aymeric Augustin bdca5ea345 [py3] Replaced unicode/str by six.text_type/bytes. 2012-07-22 09:29:54 +02:00
Aymeric Augustin 3cb2457f46 [py3] Replaced basestring by six.string_types. 2012-07-22 09:29:54 +02:00
Aymeric Augustin 56dbe924a6 [py3] Removed longs. 2012-07-22 09:29:53 +02:00
Aymeric Augustin d11d45aad9 [py3] Used six.with_metaclass wherever necessary. 2012-07-22 09:29:52 +02:00
Aymeric Augustin 7fa51a24a8 [py3] Exception aren't iterable in Python 3. 2012-07-22 09:29:52 +02:00
Aymeric Augustin d796c94b03 [py3] Used six.reraise wherever necessary. 2012-07-22 09:29:52 +02:00
Alex Gaynor 52df0d50b0 Switched to use a more idiomatic construct. 2012-07-17 07:01:01 -07:00
Anssi Kääriäinen 29132ebdef Fixed #17788 -- Added batch_size argument to qs.bulk_create()
The qs.bulk_create() method did not work with large batches together
with SQLite3. This commit adds a way to split the bulk into smaller
batches. The default batch size is unlimited except for SQLite3 where
the batch size is limited to 999 SQL parameters per batch.

Thanks to everybody who participated in the discussions at Trac.
2012-07-17 15:24:41 +03:00
Anssi Kääriäinen fcad6c48f0 Fixed #17497 -- Corrected FieldError message in add_fields()
The erroneous message was user visible in values_list() calls.

Thanks to ojii for report and review, and to antoviaque for the patch.
2012-07-17 12:49:46 +03:00
Nuno Maltez bebbbb7af0 Fixed #18056 - Cleared aggregations on DateQuery.add_date_select
Cleared aggregations on add_date_select method so only distinct dates
are returned when dealing with a QuerySet that contained aggregations.
That would cause the query set to return repeated dates because it
would look for distinct (date kind, aggregation) pairs.
2012-07-16 19:52:31 +03:00
Alex Gaynor 9877d25dc6 Switched from usign a method that was about to be deprecated to normal code. 2012-07-14 16:02:30 -07:00
Alex Gaynor fb8ec2855b Remove some code that has been dead since newforms-admin was merged, many moons ago. 2012-07-12 09:27:08 -07:00
Claude Paroz 828f7b62e8 Fixed #18602 -- Improved error message when database NAME is missing
Thanks Kristian Glass for the report.
2012-07-10 13:22:55 +02:00
Claude Paroz 146aff3bac Fixed #18590 - Reverted Python 2.4 workaround for Model pickling
Revert of 08d521efa0. Refs #10547, #12121.
Thanks Michal Petrucha for the report.
2012-07-08 20:08:28 +02:00
Anssi Kääriäinen d3c2eb103f Fixed #18330 - Made cache culling 3rd party db backend friendly
This is Ian Kelly's patch from #15580 with minor modifications.
2012-07-05 17:20:48 +03:00
Andrei Antoukh 0f49b2bce2 Fixed #18362 - Made model.save() update_fields accept attnames 2012-07-05 16:43:28 +03:00
Anssi Kääriäinen ab7f071058 Fixed comment wording in sql/where.py
Thanks to Simon Charette for noticing this.
2012-07-03 10:31:06 +03:00
Anssi Kääriäinen e74787391e Fixed a regression introduced in where.as_sql() refactor
At least Oracle needs parentheses in negated where conditions, even if
there is only single condition negated. Fixed this by reverting to old
logic in that part of as_sql() and adding a comment about this.

I did not investigate why the parentheses are needed. The original
offending commit was bd283aa844.
2012-07-01 22:52:35 +03:00
Anssi Kääriäinen f572ee0c65 Fixed #16047 -- Restore autocommit state correctly on psycopg2
When the postgresql_psycopg2 backend was used with DB-level autocommit
mode enabled, after entering transaction management and then leaving
it, the isolation level was never set back to autocommit mode.

Thanks brodie for report and working on this issue.
2012-07-01 19:36:43 +03:00
Anssi Kääriäinen da573fbb41 Fixed some locations to work with autocommit=True
- backends: supports_transactions()
 - select_for_update tests
2012-07-01 19:27:36 +03:00
Anssi Kääriäinen bd283aa844 Refactored the empty/full result logic in WhereNode.as_sql()
Made sure the WhereNode.as_sql() handles various EmptyResultSet and
FullResultSet conditions correctly. Also, got rid of the FullResultSet
exception class. It is now represented by '', [] return value in the
as_sql() methods.
2012-07-01 17:21:34 +03:00
Anssi Kääriäinen 2b9fb2e644 Fixed #18251 -- Removed a deadlock possibility in apploading
Thanks to harm for the report and comments.
2012-07-01 16:14:27 +03:00
Josh Smeaton fa182e8ae8 Fixed #18465 -- Set date formats correctly on Oracle
Correctly configure NLS_SESSION_PARAMETERS to format Date and DateTime
on Oracle backend.

Thanks to Josh Smeaton for report & patch.
2012-06-26 19:39:14 +03:00
Claude Paroz 05d333ba3b Fixed #18515 -- Conditionally regenerated filename in FileField validation
When a FileField value has been saved, a new validation should not
regenerate a new filename when checking the length. Refs #9893.
2012-06-26 18:18:44 +02:00
Anssi Kääriäinen b6c356b7bb Fixed #17485 -- Made defer work with select_related
This commit tackles a couple of issues. First, in certain cases there
were some mixups if field.attname or field.name should be deferred.
Field.attname is now always used.

Another issue tackled is a case where field is both deferred by
.only(), and selected by select_related. This case is now an error.

A lot of thanks to koniiiik (Michal Petrucha) for the patch, and
to Andrei Antoukh for review.
2012-06-26 18:08:42 +03:00
Alex Gaynor e0fce8706d Switch to using context managers for acquiring and releasing locks. 2012-06-23 08:11:15 -07:00
Luke Plant a54a8bab0c Fixed #17776 - DoesNotExist is not picklable
Thanks to ambv for the report
2012-06-22 13:28:15 +01:00
Andrew Godwin 959a3f9791 Add some field schema alteration methods and tests. 2012-06-19 13:25:22 +01:00