Commit graph

614 commits

Author SHA1 Message Date
Sergey Tereschenko
ef2e188e36 Prepare release 0.14.3 2020-02-14 17:34:04 +02:00
Sergey Tereschenko
da5d8c91ba fix flake8 warnings 2020-02-14 17:27:12 +02:00
Sergey Tereschenko
ce9b5e3c84 Cleanup 2020-02-14 17:22:27 +02:00
Hans de Jong
0df9e5129d updated test and also vlaidate that the correct manager is used 2020-02-13 09:14:48 +01:00
Hans de Jong
061ddca19e base_manger now working based on super 2020-02-13 07:56:54 +01:00
Hans de Jong
80731961fa The issue was that base_manager method from django is a cached property that creates a manager each time it is required. So overwriting didnt work. Now i am far from a metaclass expert and im sure this can be done neater, however this is all the time i have at the moment. Improvements shouldnt be too hard now the issue has a (ugly) fix. Also added a short test, but i am used to pytest, so forgive me for the ugly manager solution. Hope this can help you out 2020-02-12 14:38:37 +01:00
Sergey Tereschenko
bb34e8cf96 Prepare release 0.14.2 2020-01-16 13:15:41 +02:00
Donald Buczek
2c9669efd8 Don't leak into current language from .clean_fields()
Django uses .clean_fields() to verify the values of all fields of an
instance, e.g. after the instance has been updated from a form view.

.clean_fields() essentially walks over the fields in the model, reads
the current values, verifies and normalizes them, and writes them
back [1].

With model-translations activated, this can leak values from a fallback
language into the current language of the session, if the value for the
current language has been set to an empty value from a translation aware
application or form.

Example:

- current language is "en"
- fallback languages are "en", "de"
- web form wants to set "title_de" to "Schnapsidee" and leave
    "title_en" empty

After the form is submitted, Django calls .clean_fields() which
processes the field "title" first

- reads value of "title" - which gives "Schnapsidee" from
    "title_de" by the fallback mechanism of Modeltranslations
- writes this value back to "title", which sets "title_en"
    as a side effect.

Bugs have been reported at [2], [3] and [4]

Disable the implicit setting of the translation field from the
translated field ( Rule 2 of [5] ) during .clean_field() processing.

[1] bf77669453/django/db/models/base.py (L1229)
[2] https://github.com/deschler/django-modeltranslation/issues/382
[3] https://github.com/infoportugal/wagtail-modeltranslation/issues/247
[4] https://github.molgen.mpg.de/molgen/mpicms/issues/15
[5] https://django-modeltranslation.readthedocs.io/en/latest/usage.html#rules-for-translated-field-access
2020-01-16 11:58:18 +01:00
Adrian Berger
a7c0482b94 replace force_text to support django 3 2020-01-07 11:13:45 +01:00
Sergey Tereschenko
686e020974 Change permissions to 644 2019-12-18 00:30:13 +02:00
Piet van Leeuwen
4797c45385 fix for nested inlines, seems to group items inside empty-form, and then again when adding another 2019-12-12 10:05:05 +13:00
Sergey Tereschenko
ba98a0d0f0 Prepare release 0.14.1 2019-12-06 00:42:41 +02:00
Sergey Tereschenko
ef34601622 Prepare 0.14.0 release 2019-11-14 12:11:56 +02:00
Sergey Tereschenko
506986400f Merge branch 'master' of github.com:deschler/django-modeltranslation 2019-11-14 12:07:21 +02:00
Michal Arbet
7e6f912c6f Fix failing tests when local migrations are used (Fixes: #527).
The following tests issues are adressed in this patch:

- Settings are changed so that local tests.auth_migrations are used
  instead of django.contrib.auth.migrations
- Distributed django.contrib.auth.migrations are copied to
  tests.auth_migrations for tests
- All migrations are deleted from tests.auth_migrations on teardown
2019-11-13 13:25:59 +01:00
partizan
7bb8194ac9
Merge pull request #485 from fdemmer/update_translation_fields
Add app_label and model_name arguments to update_translation_fields command
2019-11-08 10:25:52 +02:00
Sergey Tereschenko
5b230d2c36 Fix extra tab lang switcher in stackedinline (close #522) 2019-10-27 22:26:19 +02:00
Sergey Tereschenko
1b36bff9ec use tests for django 3 2019-10-27 19:00:14 +02:00
Sergey Tereschenko
851bff4cb6 fix related fields translation in django 3 2019-10-27 18:58:53 +02:00
Sergey Tereschenko
74d2b0688a Merge branch 'master' of https://github.com/mvbrn/django-modeltranslation into django-3 2019-10-27 18:57:00 +02:00
partizan
30c953aa02
Merge pull request #519 from dmydlo/master
Fix admin exclude usage
2019-10-21 08:56:22 +03:00
Dirk Groten
2a92d6c7b4 Fix flake8 formatting errors 2019-10-20 20:14:52 +02:00
Dirk Groten
f42d3404e2 Added test to make sure inherited models with no custom manager still have the correct default manager 2019-10-20 20:06:44 +02:00
Dirk Groten
50a7868fa7 Documented tests better 2019-10-20 19:24:06 +02:00
Dirk Groten
b6d4cf81d3 Test to check the default manager after registering model for translation 2019-10-20 19:18:27 +02:00
Dirk Groten
33f0ca9f62 Fix creation_counter on the patched managers in order to ensure the original local managers are prioritised over the inherited managers. 2019-10-20 18:24:57 +02:00
Misha Kalyna
5505208003 explicitly install and import six (which was removed from Django 3.0) 2019-10-05 21:07:08 +02:00
Dawid Mydło
0aeede91d6 Fix admin exclude usage 2019-10-03 16:21:12 +02:00
Sergey Tereschenko
99ad8859d3 Prepare 0.13.3 release 2019-07-22 23:07:59 +03:00
Sergey Tereschenko
e69eb7b07e Don't patch template row for inlines (ref #475) 2019-07-19 20:21:18 +03:00
Sergey Tereschenko
2e30ab6288 Prepare 0.13.2 release 2019-07-02 19:54:06 +03:00
Constantine Fedenko
1e05807f20 fixed flake8 warnings 2019-07-02 14:02:22 +03:00
Constantine Fedenko
6e57ca7dc4 Fixed 'formfield_for_dbfield' method signature. See #510 2019-07-02 13:29:14 +03:00
Misha Kalyna
ae26aa0994 use get_fields hook 2019-05-29 12:16:36 +02:00
Sergey Tereschenko
18fec04a51 Prepared 0.13.1 release. 2019-04-18 01:07:41 +03:00
Sergey Tereschenko
447a60f1cc fix TabbedTranslationAdmin in django 2.2 (close #506) 2019-04-18 01:01:15 +03:00
Sergey Tereschenko
4f18363104 Merge remote-tracking branch 'origin/master' into dev 2019-04-18 00:58:34 +03:00
Sergey Tereschenko
0ea5be2ed1 fix error in handling proxy model 2019-04-17 00:27:02 +03:00
Sergey Tereschenko
80bd452894 fix tests: use path to file 2019-04-16 23:40:48 +03:00
partizan
4a4f3a0dfa
Merge pull request #500 from numrut/admin_m2m
Fix #332 fields list bug in admin.TranslationAdmin
2019-03-31 21:43:29 +03:00
Melvyn Sopacua
1a116e9d5c feat(make-jquery-urls-configurable): Add settings
Add 3 new settings, without prefix that deal with external resources.
This allows software with elevated security restrictions to function
properly.
2019-03-30 14:31:31 +01:00
Yevhen Amelin
5e0e95a7e7 Fix fields list bug in admin.TranslationAdmin 2019-03-28 14:29:19 +02:00
Sergey Tereschenko
750b4b043e Prepared 0.13-beta3 release 2019-02-21 10:54:20 +02:00
Mariusz Felisiak
6cb1009afe
Used postgresql back-end instead of deprecated django.db.backends.postgresql_psycopg2.
django.db.backends.postgresql_psycopg2 has been removed in Django 3.0.
2019-02-18 12:13:17 +01:00
Sergey Tereschenko
41eb6940d4 Prepared 0.13-beta3 release 2019-02-17 22:47:01 +02:00
Sergey Tereschenko
bffe85d965 Merge branch 'master' into 467-rev-lookup-error
# Conflicts:
#	modeltranslation/tests/tests.py
#	modeltranslation/translator.py
2019-02-17 22:41:04 +02:00
Sergey Tereschenko
bbcd98d6dc Make all managers local for this model (ref #467) 2019-02-17 22:19:06 +02:00
Sergey Tereschenko
6dfbe321fa tests: fix models count 2019-02-17 19:21:15 +02:00
Sergey Tereschenko
786a876f0d fix tests 2019-02-16 17:17:00 +02:00
Sergey Tereschenko
68ea5a870d tests update
- use decorators by default
 - remove extra decorator registration test
 - use models as module instead of importing every model
2019-02-16 16:53:21 +02:00