Hi,

I want to add that I checked the Django 3.0 release notes [
https://docs.djangoproject.com/en/3.0/releases/3.0/ ] and also releases
from 3.0.1 to 3.0.5 and I didn't find any documentation of this issue.

אורי
[email protected]


‪On Fri, Apr 10, 2020 at 10:28 AM ‫אורי‬‎ <[email protected]> wrote:‬

> Hi,
>
> We are using Django 2.2 and I want to upgrade to Django 3.0. We have a
> mixin (written in 2017) that add fields to forms:
>
> class LocalizedFirstLastNameMixin(object):
>     def __init__(self, *args, **kwargs):
>         self.language_code = kwargs.pop('language_code', 'en')
>         super().__init__(*args, **kwargs)
>         for loc_field in reversed(self.get_localized_fields()):
>             self.fields[loc_field] = 
> User._meta.get_field(loc_field).formfield()
>             self.fields[loc_field].required = True
>             self.fields.move_to_end(loc_field, last=False)
>             self.initial[loc_field] = getattr(self.instance, loc_field, '')
>
> It works with Django versions up to 2.2. But when I upgrade to 3.0, I get
> this error message:
>
> AttributeError: 'dict' object has no attribute 'move_to_end'
>
> This function's info:
>
> '''Move an existing element to the end (or beginning if last==False).
>
> And it belongs to OrderedDict.
>
> So I guess we want these fields to be in the beginning of the form fields.
>
> Is there a change in the implementation of the fields in forms and how do
> I specify the order of fields? And if I change it, will it work in previous
> versions such as Django 2.2?
>
> Thanks,
> Uri.
> אורי
> [email protected]
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABD5YeHSu6cg-80i_c-YfAt%2BRN53octmYAtm-R2HU6tvpBE%2B-g%40mail.gmail.com.

Reply via email to