99 Commits

Author SHA1 Message Date
Swen Kooij
e6527fff4c Don't double key transform in lookups
In Django 4.2, `process_lhs()` is called for IsNull lookups,
which is how this bug came to appear. It was already there
and could be reproduced on Django 3.2.

The issue is when `LocalizedRef` is combined with a localized
lookup. The lookup is unaware of the existing localized ref
and adds another transform on top. This results in the
expression becoming:

```
field->'en'->'en'
```
2024-07-02 07:10:41 +03:00
Tudor Văran
5bb16af6a4
Support for Django 4 (#101)
* Support for Django 4

* Change pytest-django version

* Change psycopg2 version

* Change pytest version

* Change tox version

* Change pytest-cov version

* Update circle ci jobs

* Fix ci jobs

* Update ci to postgres 12

* Allow Django 5.0

* Bump Django min version to 3.2

* Fix CI to account for >= 3.2 requirement

* Fix quote

* Remove python 3.12 for now due to distutils removal

* Remove Django upper bound

* Add back python3.6,3.7 wfs

* Downgrade dj-database-url

* Fix isnull issue from Django 4
2024-06-04 12:49:13 +03:00
Gherman Razvan
911251ebaa
Prevent LocalizedBleachField from escaping values (#97) 2024-01-23 13:52:37 +01:00
Gherman Razvan
a66b3492cd
Add LocalizedBooleanField (#93) 2023-08-10 14:33:47 +02:00
Swen Kooij
92cb5e8b1f Add LocalizedValue.is_empty() 2021-03-22 07:47:00 +02:00
Swen Kooij
1b3e5989d3 LocalizedUniqueSlugField should properly deconstruct 'enabled' flag 2021-03-13 13:45:22 +02:00
Swen Kooij
bd8924224e Add flag to disable LocalizedUniqueSlugField 2021-03-13 13:24:36 +02:00
Swen Kooij
afb94ecf66 Add a flag to make LocalizedUniqueSlugField immutable 2020-11-27 16:36:23 +02:00
seroy
da4b1701c7 add tests for ActiveRef and TranslatedRef lookups 2020-10-07 12:32:22 +03:00
Alexandru Arnautu
8968b0c7a8
Format and lint code 2020-03-10 09:33:34 +02:00
Alexandru Arnautu
0f1d6636f6 Add tests for float field 2020-03-10 09:27:42 +02:00
tudorvaran
bc63c57598 LocalizedIntegerField not LocalizedIntegerValue 2020-02-12 17:11:14 +02:00
tudorvaran
905bfd4353 Format with black 2020-02-12 17:05:17 +02:00
tudorvaran
a9a5add303 Manual code format 2020-02-12 16:55:39 +02:00
tudorvaran
598b8ca65e Add test 2020-02-12 16:51:34 +02:00
Swen Kooij
49d88af76a Python 3.6, 3.9 and Django 3.0 compatibility 2020-01-06 16:51:30 +01:00
Swen Kooij
7bf0311306 Add a language argument to LocalizedValue.translate(..) 2019-10-20 16:49:33 +03:00
Swen Kooij
e5dcc1b492 Fix #72: LocalizedIntegerField should sort numerically, not lexicographically 2019-10-19 15:48:29 +03:00
Swen Kooij
696050cf6b Fix warning in tests because test class is prefixed with Test 2019-10-19 14:11:41 +03:00
Swen Kooij
19f0ddb336 Fix some flake8/pycodestyle issues 2019-10-19 13:04:53 +03:00
Swen Kooij
7cdd1f4490 Re-format all files 2019-10-19 12:44:41 +03:00
Swen Kooij
39495da918 Add test for falling back to default value during an update 2019-10-06 21:16:40 +03:00
Swen Kooij
25417b5815
Merge pull request #56 from sliverc/user_defined_pk_descriptor
Avoid DoesNotExist error when creating model with user defined pk
2019-01-11 14:47:33 +02:00
Swen Kooij
abd1587ca0
Merge pull request #54 from sliverc/query_by_active_lang
Add support for localized query lookups
2019-01-11 14:47:18 +02:00
Swen Kooij
ca470fc577
Merge pull request #49 from MELScience/admin-fix
Add tests for LocalizedFieldsAdminMixin
2019-01-11 14:46:10 +02:00
Swen Kooij
b2f50ec82b Convert to use CircleCI and run tests against Django 2.1/Python 3.7 2019-01-11 14:37:03 +02:00
Oliver Sauder
ff836836bf Add support for localized query look ups 2018-12-03 09:45:08 +01:00
Oliver Sauder
b3b88d6d28 Avoid does not exist error when creating model with user defined pk 2018-09-10 12:05:46 +02:00
Cristi Ingineru
4f83cbf4ed Add LocalizedIntegerFieldWidget 2018-08-16 14:27:38 +03:00
Cristi Ingineru
13e2666a51 Copy the widget for each language 2018-06-28 12:33:44 +03:00
Swen Kooij
1b1d24a460 Make defaults work for LocalizedIntegerField 2018-06-15 17:07:12 +03:00
Swen Kooij
fb233e8f25 Make sure values are strings before saving LocalizedIntegerValue 2018-06-15 16:19:32 +03:00
Swen Kooij
90597da8fd Add a LocalizedIntegerField 2018-06-15 12:58:01 +03:00
Swen Kooij
def7dae640 Add LocalizedValue.translate()
LocalizedValue.translate() behaves the exact same as the str(..) cast
works, with the exception that it returns None if there is no value
instead of an empty string. This makes it easier to implement custom
value classes on top of the LocalizedValue class.

Behavior for str(..) stays the same as it was.
2018-06-14 07:57:02 +03:00
seroy
b3624916b2 Add tests for LocalizedFieldsAdminMixin 2018-04-20 02:27:57 +03:00
Swen Kooij
ccc46e1899 Allow raw dicts to be used in update statements 2018-03-31 16:53:10 +03:00
Swen Kooij
af02593ebd Add test to make sure LocalizedValue doesn't cast values to string 2018-03-31 08:52:12 +03:00
seroy
6a4beca193 fix tests on Django 2.0 2018-01-29 13:30:43 +02:00
seroy
928c4c624d Add test whether get_context contains 'lang_code' and 'lang_name' attribute 2017-07-18 13:54:53 +03:00
Swen Kooij
1accee0b59 Merge branch 'master' into widget_refactor 2017-07-18 09:33:59 +03:00
Swen Kooij
05bcd84a88 Merge pull request #29 from MELScience/required
Improved functionality of required parameter
2017-07-18 09:33:24 +03:00
seroy
6522e38f18 Added tests for LocalizedFieldWidget.get_context method 2017-07-18 01:03:50 +03:00
seroy
0f08eb8280 Add test on render method 2017-07-17 22:05:31 +03:00
seroy
33e9709373 Add tests for 'required' attribute 2017-07-17 20:55:13 +03:00
Swen Kooij
7d629c186d Add basic tests for 'required' attribute 2017-07-16 12:22:48 +03:00
Swen Kooij
08690ab361 Fix outstanding PEP8 and Flake8 issues 2017-07-15 14:06:50 +03:00
seroy
aaf49614f2 improve functionality of required parameter 2017-07-14 15:07:48 +03:00
seroy
2b34b6751e Added test for value_to_string method 2017-06-26 18:08:15 +03:00
Swen Kooij
32696f4e1e Add test that confirms slug is re-computed when value changes 2017-06-26 14:01:25 +03:00
Swen Kooij
7316d312b4 Add simple test for LOCALIZED_FIELDS_FALLBACKS setting 2017-06-26 13:36:21 +03:00