summaryrefslogtreecommitdiff
path: root/tests/model_fields/tests.py
AgeCommit message (Collapse)Author
2015-03-25Fixed #24215 -- Refactored lazy model operationsAlex Hill
This adds a new method, Apps.lazy_model_operation(), and a helper function, lazy_related_operation(), which together supersede add_lazy_relation() and make lazy model operations the responsibility of the App registry. This system no longer uses the class_prepared signal.
2015-03-25Renamed Field.rel attribute to remote_fieldAnssi Kääriäinen
Field.rel is now deprecated. Rel objects have now also remote_field attribute. This means that self == self.remote_field.remote_field. In addition, made the Rel objects a bit more like Field objects. Still, marked ManyToManyFields as null=True.
2015-03-24Fixed #24483 -- Prevented keepdb from breaking with generator choices.David Szotten
If Field.choices is provided as an iterator, consume it in __init__ instead of using itertools.tee (which ends up holding everything in memory anyway). Fixes a bug where deconstruct() was consuming the iterator but bypassing the call to `tee`.
2015-02-21Fixed #24376 -- added verbose_name arg to UUIDFieldMichael Angeletti
2015-02-12Refs #24215 -- Prevented pending lookup pollution by abstract models.Simon Charette
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2015-01-20Fixed typos in code comments.Adam Taylor
2015-01-19Removed IPAddressField per deprecation timeline; refs #20439.Tim Graham
2015-01-16Fixed #24092 -- Widened base field support for ArrayField.Marc Tamlyn
Several issues resolved here, following from a report that a base_field of GenericIpAddressField was failing. We were using get_prep_value instead of get_db_prep_value in ArrayField which was bypassing any extra modifications to the value being made in the base field's get_db_prep_value. Changing this broke datetime support, so the postgres backend has gained the relevant operation methods to send dates/times/datetimes directly to the db backend instead of casting them to strings. Similarly, a new database feature has been added allowing the uuid to be passed directly to the backend, as we do with timedeltas. On the other side, psycopg2 expects an Inet() instance for IP address fields, so we add a value_to_db_ipaddress method to wrap the strings on postgres. We also have to manually add a database adapter to psycopg2, as we do not wish to use the built in adapter which would turn everything into Inet() instances. Thanks to smclenithan for the report.
2015-01-11Removed supports_binary_field flag as all backends support themClaude Paroz
It was mainly for MySQL on Python 3, but now the current recommended MySQL driver for Python 3 (mysqlclient) does support binary fields, it is unneeded. Refs #20377.
2015-01-07Fixed #24078 -- Removed empty strings from GenericIPAddressFieldJosh Smeaton
2015-01-06Fixed #12663 -- Formalized the Model._meta API for retrieving fields.Daniel Pyrathon
Thanks to Russell Keith-Magee for mentoring this Google Summer of Code 2014 project and everyone else who helped with the patch!
2015-01-01Fixed #23891 -- Moved deprecation of IPAddressField to system check framework.Tim Graham
Thanks Markus Holtermann for review.
2014-12-30Applied ignore_warnings to Django testsClaude Paroz
2014-12-12Fixed #23455 -- Accept either bytes or text for related_name, convert to text.Carl Meyer
2014-11-27Fixed #23338 -- Added warning when unique=True on ForeigKeyDiego Guimarães
Thanks Jonathan Lindén for the initial patch, and Tim Graham and Gabe Jackson for the suggestions.
2014-11-03Fixed #23620 -- Used more specific assertions in the Django test suite.Berker Peksag
2014-08-05Removed code that assumed BooleanField could be null.Tim Graham
Such a field will no longer pass model validation.
2014-07-30Fixed #23112 -- Field.get_choices tries to index an iterableareski
2014-07-30Fixed flake8 errors.Tim Graham
2014-07-27Fixed #23098 -- Checked that lazy choices are not evaluated too soonFlorian Apolloner
Thanks Matthieu Agopian for the report.
2014-05-08Replaced vendor checks by three feature flags.Aymeric Augustin
2014-04-21Fixed queries that may return unexpected results on MySQL due to typecasting.Erik Romijn
This is a security fix; disclosure to follow shortly.
2014-04-09Used more specific test assertions.Aymeric Augustin
2014-03-25Fixed #12030 -- Validate integer field range at the model level.Simon Charette
Thanks to @timgraham for the review.
2014-03-13Skip test for saving microseconds on backends which do not support it.Shai Berger
2014-03-12Fixed #20292: Pass datetime objects (not formatted dates) as params to OracleShai Berger
This seems worthwhile in its own right, but also works around an Oracle bug (in versions 10 -- 11.1) where the use of Unicode would reset the date/time formats, causing ORA-01843 errors. Thanks Trac users CarstenF for the report, jtiai for the initial patch, and everyone who contributed to the discussion on the ticket.
2014-03-12Fixed test failure on Oracle: model_fields.tests.test_float_validates_objectShai Berger
Failing test introduced in fix for refs #22210.
2014-03-10Fixed #22210 -- Saving model instances to non-related fields.Daniel Pyrathon
Previously, saving a model instance to a non-related field (in particular a FloatField) would silently convert the model to an Integer (the pk) and save it. This is undesirable behaviour, and likely to cause confusion so the validatio has been hardened. Thanks to @PirosB3 for the patch and @jarshwah for the review.
2014-03-05Fixed #22206 -- Passed models.TextField.max_length to forms.CharField.maxlengthChris Wilson
2014-03-03Fixed many typos in comments and docstrings.Rodolfo Carvalho
Thanks Piotr Kasprzyk for help with the patch.
2014-02-15Fixed #19299 -- Fixed Nullification of Foreign Keys To CharFieldsAlbert Wang
Thanks tunixman for the report and Baptiste Mispelon and Shai Berger for reviews.
2014-01-20Fixed #16905 -- Added extensible checks (nee validation) frameworkRussell Keith-Magee
This is the result of Christopher Medrela's 2013 Summer of Code project. Thanks also to Preston Holmes, Tim Graham, Anssi Kääriäinen, Florian Apolloner, and Alex Gaynor for review notes along the way. Also: Fixes #8579, fixes #3055, fixes #19844.
2013-11-02PEP8 cleanupJason Myers
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2013-10-19Removed unused local variables in tests.Tim Graham
2013-09-28Fixed #20439 -- Started deprecation of IPAddressFieldErik Romijn
2013-09-03Removed references to django.utils.unittest which is PendingDeprecationTim Graham
2013-08-30Fixed #20999 - Allow overriding formfield class with choices, without ↵Carl Meyer
subclass restrictions. Refs #18162. Thanks claudep and mjtamlyn for review.
2013-08-29Altered test introduced in f19a3669b8 for the sake of readability. refs #14786Simon Charette
2013-08-29Fixed #14786 -- Fixed get_db_prep_lookup calling get_prep_value twice if ↵Tim Graham
prepared is False. Thanks homm for the report and Aramgutang and lrekucki for work on the patch.
2013-08-15Fixed #20895 -- Made check management command warn if a BooleanField does ↵Alasdair Nicol
not have a default value Thanks to Collin Anderson for the suggestion and Tim Graham for reviewing the patch.
2013-07-31Fixed #20649 -- Allowed blank field display to be defined in the initial ↵Alex Couper
list of choices.
2013-07-31Fixed #20348 -- Consistently handle Promise objects in model fields.Tai Lee
All Promise objects were passed to force_text() deep in ORM query code. Not only does this make it difficult or impossible for developers to prevent or alter this behaviour, but it is also wrong for non-text fields. This commit changes `Field.get_prep_value()` from a no-op to one that resolved Promise objects. All subclasses now call super() method first to ensure that they have a real value to work with.
2013-07-29Removed most of absolute_import importsClaude Paroz
Should be unneeded with Python 2.7 and up. Added some unicode_literals along the way.
2013-07-12Fixed #20740 -- GenericIPAddressField should pass protocol to formfield()Tim Graham
Thanks Jeff250.
2013-07-01Stopped using django.utils.unittest in the test suite.Aymeric Augustin
Refs #20680.
2013-06-29Fixed #20660 -- Do not try to delete an unset FieldFileClaude Paroz
Thanks stanislas.guerra at gmail.com for the report and Baptiste Mispelon for the review.
2013-05-21Use assertIsInstance in tests.Marc Tamlyn
Gives much nicer errors when it fails.
2013-05-10Fixed #17365, #17366, #18727 -- Switched to discovery test runner.Carl Meyer
Thanks to Preston Timmons for the bulk of the work on the patch, especially updating Django's own test suite to comply with the requirements of the new runner. Thanks also to Jannis Leidel and Mahdi Yusuf for earlier work on the patch and the discovery runner. Refs #11077, #17032, and #18670.
2013-05-08Marked tests of BinaryFields as expected failures on MySQL and Python 3.Aymeric Augustin
Current ports of MySQLdb are very buggy in this area.