On Fri, Apr 10, 2020, 12:29 AM אורי <u...@speedy.net> 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.
> אורי
> u...@speedy.net
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABD5YeEbHc5ewqJKEFAS5XV1JfD%3DEqf8%3D_ScgjhTC5VY2NsDpw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABD5YeEbHc5ewqJKEFAS5XV1JfD%3DEqf8%3D_ScgjhTC5VY2NsDpw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

By chance did you change Python versions as well?

-Jorge

>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK9oviOz%3DO%3DR9M3Cu5U7WVRMuRqphro8SNRFPq0tZLtqmQ%40mail.gmail.com.

Reply via email to