Hi, Django 4.0 had this code:
errors = {} if exclude is None: exclude = [] else: exclude = list(exclude) try: self.clean_fields(exclude=exclude) except ValidationError as e: errors = e.update_error_dict(errors) In Django 4.1 alpha it looks like this: errors = {} if exclude is None: exclude = set() else: exclude = set(exclude) try: self.clean_fields(exclude=exclude) except ValidationError as e: errors = e.update_error_dict(errors) My model tests fail: ====================================================================== ERROR: test_username_too_long_exception_4 (speedy.core.accounts.tests.test_models.ReservedUsernameHebrewTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\Uri\Speedy_Net\Git\speedy-net-public\speedy\core\accounts\tests\test_models.py", line 395, in test_username_too_long_exception_4 reserved_username.save() File "D:\Uri\Speedy_Net\Git\speedy-net-public\speedy\core\base\models.py", line 21, in save return super().save(*args, **kwargs) File "D:\Uri\Speedy_Net\Git\speedy-net-public\speedy\core\base\models.py", line 12, in save self.full_clean() File "D:\Uri\Speedy_Net\Git\speedy-net-public\.venv_3.9\lib\site-packages\django\db\models\base.py", line 1464, in full_clean self.clean_fields(exclude=exclude) File "D:\Uri\Speedy_Net\Git\speedy-net-public\speedy\core\accounts\models.py", line 182, in clean_fields exclude += ['username', 'slug'] TypeError: unsupported operand type(s) for +=: 'set' and 'list' ---------------------------------------------------------------------- Is `exclude` a set now (instead of a list) and where is it documented? If it's not documented, please document it. I didn't find it documented on https://docs.djangoproject.com/en/dev/releases/4.1/. What is the best written code to change the line `exclude += ['username', 'slug']` in my code? Is it `exclude |= set(['username', 'slug'])` or `exclude |= {'username', 'slug'}`? Or should I convert to list and then back to set? What is the reason `exclude` was changed to a set? Thanks, Uri. אורי u...@speedy.net On Wed, May 18, 2022 at 9:09 AM Carlton Gibson <carlton.gib...@gmail.com> wrote: > Details are available on the Django project weblog: > > > https://www.djangoproject.com/weblog/2022/may/18/django-41-alpha-1-released/ > > > -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-developers+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/CAJwKpyQmCB6q__p167GcmaH8dBT%3D-jSbtr2LLb_E63E9QRQUXQ%40mail.gmail.com > <https://groups.google.com/d/msgid/django-developers/CAJwKpyQmCB6q__p167GcmaH8dBT%3D-jSbtr2LLb_E63E9QRQUXQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CABD5YeFuepUy_Mr6fqvPU6GX-0su-8SXpW8W2P4%3DjfWbxwTgPQ%40mail.gmail.com.