summaryrefslogtreecommitdiff
path: root/django/db/models
AgeCommit message (Collapse)Author
2012-08-03Replaced some byte strings by str() callsClaude Paroz
This is a useful trick when Python 2 awaits byte strings and Python 3 Unicode (regular) strings.
2012-07-23Removed a Python 3-compatibility hack.Aymeric Augustin
Thanks Preston Holmes for the patch.
2012-07-22[py3] Added Python 3 compatibility for xrange.Aymeric Augustin
2012-07-22[py3] Switched to Python 3-compatible imports.Aymeric Augustin
xrange/range will be dealt with in a separate commit due to the huge number of changes.
2012-07-22[py3] Replaced unicode/str by six.text_type/bytes.Aymeric Augustin
2012-07-22[py3] Replaced basestring by six.string_types.Aymeric Augustin
2012-07-22[py3] Removed longs.Aymeric Augustin
2012-07-22[py3] Used six.with_metaclass wherever necessary.Aymeric Augustin
2012-07-22[py3] Used six.reraise wherever necessary.Aymeric Augustin
2012-07-17Switched to use a more idiomatic construct.Alex Gaynor
2012-07-17Fixed #17788 -- Added batch_size argument to qs.bulk_create()Anssi Kääriäinen
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-17Fixed #17497 -- Corrected FieldError message in add_fields()Anssi Kääriäinen
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-16Fixed #18056 - Cleared aggregations on DateQuery.add_date_selectNuno Maltez
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-14Switched from usign a method that was about to be deprecated to normal code.Alex Gaynor
2012-07-12Remove some code that has been dead since newforms-admin was merged, many ↵Alex Gaynor
moons ago.
2012-07-08Fixed #18590 - Reverted Python 2.4 workaround for Model picklingClaude Paroz
Revert of 08d521efa0. Refs #10547, #12121. Thanks Michal Petrucha for the report.
2012-07-05Fixed #18362 - Made model.save() update_fields accept attnamesAndrei Antoukh
2012-07-03Fixed comment wording in sql/where.pyAnssi Kääriäinen
Thanks to Simon Charette for noticing this.
2012-07-01Fixed a regression introduced in where.as_sql() refactorAnssi Kääriäinen
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 bd283aa844b04651b7c8b4e85f48c6dced1678f0.
2012-07-01Refactored the empty/full result logic in WhereNode.as_sql()Anssi Kääriäinen
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-01Fixed #18251 -- Removed a deadlock possibility in apploadingAnssi Kääriäinen
Thanks to harm for the report and comments.
2012-06-26Fixed #18515 -- Conditionally regenerated filename in FileField validationClaude Paroz
When a FileField value has been saved, a new validation should not regenerate a new filename when checking the length. Refs #9893.
2012-06-26Fixed #17485 -- Made defer work with select_relatedAnssi Kääriäinen
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-23Switch to using context managers for acquiring and releasing locks.Alex Gaynor
2012-06-22Fixed #17776 - DoesNotExist is not picklableLuke Plant
Thanks to ambv for the report
2012-06-11Fixed #18463 -- Forced type() argument to be a byte stringClaude Paroz
2012-06-07Fixed #18432 -- Prevented the ForeignKey field from creating an invalid ↵Jann Kleen
query when chained. Thanks, Jann Kleen.
2012-06-07Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.Claude Paroz
Thanks Vinay Sajip for the support of his django3 branch and Jannis Leidel for the review.
2012-06-06Small cleanup in prefetch_related codeLuke Plant
2012-06-06Fixed #18309 - Prefetch related does not work for fkey to multitable ↵Luke Plant
inherited model Thanks to milosu for the report, tests and initial patch.
2012-06-01Fixed a typo in a comment. Refs #17742.Aymeric Augustin
2012-05-31Fixed #18407 -- Made model field's to_python methods fully accept unicode.Claude Paroz
When generating error message in to_python, any unicode string containing non-ascii characters triggered a UnicodeEncodeError for most field types.
2012-05-27Fixed #18343 -- Cleaned up deferred model implementationAnssi Kääriäinen
Generic cleanup and dead code removal in deferred model field loading and model.__reduce__(). Also fixed an issue where if an inherited model with a parent field chain parent_ptr_id -> id would be deferred loaded, then accessing the id field caused caused a database query, even if the id field's value is already loaded in the parent_ptr_id field.
2012-05-24Fixed qs.order_by() join promotion for already existing joinsAnssi Kääriäinen
When order_by causes new joins to be added to the query, the joins must be LEFT OUTER joins for nullable relations, otherwise the order_by could cause the results to be altered. This commit fixes the logic to only promote new joins, previously all joins in the order_by lookup path were promoted. Thanks to Bruno Desthuilliers for spotting this corner case.
2012-05-24Fixed #18177 -- Cached known related instances.Aymeric Augustin
This was recently fixed for one-to-one relations; this patch adds support for foreign keys. Thanks kaiser.yann for the report and the initial version of the patch.
2012-05-22Replaced 'next' testing by collections.Iterator testing.Claude Paroz
The new construct is also Python 3 compatible (where 'next' has been renamed to '__next__').
2012-05-22Fixed #18304 -- Optimized save() when update_can_self_select=FalseAnssi Kääriäinen
Databases with update_can_self_select = False (MySQL for example) generated non-necessary queries when saving a multitable inherited model, and when the save resulted in update.
2012-05-19Marked bytestrings with b prefix. Refs #18269Claude Paroz
This is a preparation for unicode literals general usage in Django (Python 3 compatibility).
2012-05-17Fixed #9893 -- Validated the length of file namesAymeric Augustin
after the full file name is generated by the storage class. Thanks Refefer for the report, carsongee for the patch, and everyone else involved in the discussion.
2012-05-12Fixed #4102 -- Allow update of specific fields in model.save()Andrei Antoukh
Added the ability to update only part of the model's fields in model.save() by introducing a new kwarg "update_fields". Thanks to all the numerous reviewers and commenters in the ticket
2012-05-10Replaced foo.next() by next(foo).Claude Paroz
This new syntax for next() has been introduced in Python 2.6 and is compatible with Python 3.
2012-05-09Fix proxy model Query.remove_inherited_models()Anssi Kääriäinen
Fixed #18248 -- proxy models were added to included_inherited_models in sql.query.Query. The variable is meant to be used for multitable inheritance only. This mistake caused problems in situations where proxy model's query was reused.
2012-05-07Made model fields comparable to other objectsSimon Charette
Fixed #17851 -- Added __lt__ and @total_ordering to models.Field, made sure these work correctly on other objects than Field, too.
2012-05-07Imported zip from future_builtins instead of itertools.izip.Claude Paroz
In Python 3, itertools.izip is not available any more (behaviour integrated in standard zip).
2012-05-01Fixed #17742 -- Handled aware datetimes in DateFieldAymeric Augustin
Converted aware datetimes to the default time zone before using them in the context of a DateField.
2012-04-29Switch a datastructure internal to the ORM to be a set, instead of a dictionary.Alex Gaynor
2012-04-29Fixed #17644 -- Changed Query.alias_map to use namedtuplesAdrian Holovaty
This makes the code easier to understand and may even have a benefit in memory usage (namedtuples instead of dicts). Thanks, lrekucki and akaariai
2012-04-29Fixed #18013 -- Use the new 'as' syntax for exceptions.Claude Paroz
Thanks Clueless for the initial patch. Note that unittest has been purposely left out (external package only used by Python 2.6).
2012-04-29Removed unused variable from sql/query.pyAnssi Kääriäinen
2012-04-29Prevent Oracle from changing field.null to TrueAnssi Kääriäinen
Fixed #17957 -- when using Oracle and character fields, the fields were set null = True to ease the handling of empty strings. This caused problems when using multiple databases from different vendors, or when the character field happened to be also a primary key. The handling was changed so that NOT NULL is not emitted on Oracle even if field.null = False, and field.null is not touched otherwise. Thanks to bhuztez for the report, ramiro for triaging & comments, ikelly for the patch and alex for reviewing.