Commit Graph

337 Commits

Author SHA1 Message Date
Curtis Maloney 9f73009e98 Fixed #25215 -- Solved reference to forms.HStoreField in declaration of HStoreField
Correct test which was using the model field in a test form.
2015-08-04 19:15:22 +10:00
Flavio Curella c2e70f0265 Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField 2015-07-27 18:28:13 -04:00
Adam Chainz d34d39ade7 Fixed #24894 -- Added contrib.postgres.functions.TransactionNow 2015-06-15 14:03:17 -04:00
Andriy Sokolovskiy 2a7c59cd88 Added missing tests for transforms usage with subquery for PostgreSQL fields 2015-06-06 09:04:53 -04:00
Matthew Somerville 8a842148b6 Switch to aware datetimes in test. 2015-06-06 13:05:29 +01:00
Matthew Somerville 86d9b10dc3 Instead of using DjangoJSONEncoder, use base_field's value_to_string.
Note this means the serialization of e.g. IntegerRangeField now has
strings for lower and upper, so use to_python when they came back in
(same behaviour as ArrayField, hopefully, from where I also got the
set_attributes_from_name function).
2015-06-06 12:55:04 +01:00
Matthew Somerville 2926559cce Fixed #24937 -- fix serialization of Date(Time)RangeField.
Use the DjangoJSONEncoder so that datetime and date are encoded
appropriately.
2015-06-05 22:01:42 +01:00
Marc Tamlyn 7bda2d8ebc Fixed #24837 -- field__contained_by=Range
Provide `contained_by` lookups for the equivalent single valued fields
related to the range field types. This acts as the opposite direction to
rangefield__contains.

With thanks to schinckel for the idea and initial tests.
2015-06-04 19:29:59 +01:00
Marc Tamlyn 00e8e514e1 Name PostgreSQL correctly. 2015-05-30 23:10:30 +01:00
Marc Tamlyn 33ea472f69 Fixed #24604 -- Added JSONField to contrib.postgres. 2015-05-30 23:10:30 +01:00
Marc Tamlyn 74fe4428e5 Add HasAnyKeys lookup for HStoreField. 2015-05-30 21:39:45 +01:00
Villiers Strauss 614bec41b5 Fixed #24841 -- Made BaseRangeField.prepare_value() call base_field's prepare_value() 2015-05-25 12:06:55 -04:00
Florian Apolloner 6128005d90 Fixed forms import. 2015-05-24 17:52:35 +02:00
Andrea Grandi 43b2d88a5b Fixed #24844 -- Corrected has_changed implementation for HStoreField. 2015-05-24 17:32:16 +02:00
Tim Graham 3c8fe5dddf Fixed #24751 -- Fixed HStoreField isnull lookup. 2015-05-13 10:31:59 -04:00
Alasdair Nicol eaeea6f947 Fixed #24714 -- Used more specific assertions than assertEqual in tests. 2015-04-28 09:31:04 -04:00
Claude Paroz 36e90d1f45 Stopped special-casing postgres-specific tests
Refs #23879.
2015-04-18 15:17:49 +02:00
Andriy Sokolovskiy e4cf8c8420 Fixed #24301 -- Added PostgreSQL-specific aggregate functions 2015-03-30 10:44:37 -04:00
foresmac 1d1d5d1c31 Fixed #24341 -- Added specific error messages to RangeField subclasses 2015-02-20 16:49:15 -05:00
Marc Tamlyn c490e410af Fixed #24373 -- Added run_validators to ArrayField.
Thanks to DavidMuller for the report.
2015-02-20 11:51:46 +00:00
Tim Graham 8b39f33d78 Fixed #24290 -- Skipped postgres_tests if not running with PostgreSQL. 2015-02-17 06:34:13 -05:00
Markus Holtermann b06935a486 Refs #22962 -- Made test case use non-conflicting table names 2015-02-13 14:01:54 +01:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Ng Zhi An 4669b6a807 Fixed #24170 -- Implemented decompress for BaseRangeField widgets 2015-01-22 19:36:15 +00:00
Marc Tamlyn 0ae94d0d31 Fixes #24169 -- More arrayfield specific lookups.
varchar()[] cannot compare itself to text[]

Thanks to joelburton for the patch.
2015-01-20 09:52:23 +00:00
Marc Tamlyn 39d95fb6ad Fixed #24092 -- Widened base field support for ArrayField.
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-16 16:15:16 -05:00
Marc Tamlyn 48ad288679 Fixed #24001 -- Added range fields for PostgreSQL.
Added support for PostgreSQL range types to contrib.postgres.

- 5 new model fields
- 4 new form fields
- New validators
- Uses psycopg2's range type implementation in python
2015-01-10 16:18:19 +00:00
Jernej Kos 7c50e7eecc Fixed #24034 -- Don't always overwrite deconstruct path.
Made deconstruct path overwriting for ArrayField conditional,
so it only occurs when the deconstructed field is an instance
of ArrayField itself and not a subclass.
2014-12-21 17:31:50 +01:00
Thomas Chaumeny 17fe0bd808 Fixed #23423 -- Added unaccent lookup in django.contrib.postgres 2014-11-28 18:22:20 -05:00
Markus Holtermann 912ad03226 Fixed #23894 -- Made deconstruct methods favor kwargs over args 2014-11-28 06:05:56 -05:00
Daan Vielen a7c58eaca4 added test and fix to check for default null on ArrayField 2014-11-15 15:20:11 +00:00
Tim Graham ca48cef3b4 Removed unused import. 2014-11-04 11:27:35 -05:00
Marc Tamlyn 36f514f065 Added HStoreField.
Thanks to `django-hstore` for inspiration in some areas, and many people
for reviews.
2014-11-04 09:26:40 +00:00
Marc Tamlyn ef9f109013 Fixed #22962 -- Default values for ArrayField with migrations.
Fields normally try to force the default value to a string. As
translatable strings are not valid default values for ArrayField, we can
remove this behaviour which was causing issues with some migrations.

Thanks to @schinckel for the report.
2014-07-29 10:37:11 +01:00
Marc Tamlyn b65a2001e7 Fixed #22907 -- Array contains must have same type. 2014-07-15 19:41:26 +01:00
Marc Tamlyn 635acf42c5 Fix a test dependent on json ordering. 2014-05-22 15:05:19 +01:00
Marc Tamlyn 604162604b Added array field support for PostgreSQL.
The first part of django.contrib.postgres, including model and two form
fields for arrays of other data types.

This commit is formed of the following work:

    Add shell of postgres app and test handling.

    First draft of array fields.

    Use recursive deconstruction.

    Stop creating classes at lookup time.

    Add validation and size parameter.

    Add contained_by lookup.

    Add SimpleArrayField for forms.

    Add SplitArrayField (mainly for admin).

    Fix prepare_value for SimpleArrayField.

    Stop using MultiValueField and MultiWidget.

    They don't play nice with flexible sizes.

    Add basics of admin integration.

    Missing:
    - Tests
    - Fully working js

    Add reference document for django.contrib.postgres.fields.ArrayField.

    Various performance and style tweaks.

    Fix internal docs link, formalise code snippets.

    Remove the admin code for now.

    It needs a better way of handing JS widgets in the admin as a whole
    before it is easy to write. In particular there are serious issues
    involving DateTimePicker when used in an array.

    Add a test for nested array fields with different delimiters.

    This will be a documented pattern so having a test for it is useful.

    Add docs for SimpleArrayField.

    Add docs for SplitArrayField.

    Remove admin related code for now.

    definition -> description

    Fix typo.

    Py3 errors.

    Avoid using regexes where they're not needed.

    Allow passing tuples by the programmer.

    Add some more tests for multidimensional arrays.

    Also fix slicing as much as it can be fixed.

    Simplify SplitArrayWidget's data loading.

    If we aren't including the variable size one, we don't need to search
    like this.
2014-05-22 09:53:26 +01:00