saxix/django-adminactions

Mass Update: Type Error

jonah-juul opened this issue · 1 comments

Hello --

Getting this error below since updating to Django v4.2+ when trying to use the Mass Update Form. Any help greatly appreciated

Error during template rendering

In template /usr/local/lib/python3.8/site-packages/adminactions/templates/adminactions/mass_update.html, error at line 60

50                          <small><i>(sample)</i></small>
51                      </th>
52                    {% endif %}
53                  </tr>
54                  {% for field in adminform.form.model_fields %}
55                      <tr class="{{ field.name }}-row">
56                          <td>{% if field.field.required %}
57                              <b>{% endif %} {{ field.label_tag }}{% if field.field.required %}</b>{% endif %}  </td>
58                          <td class='col_enabler'>{% checkbox_enabler field %}</td>
59                          <td class='col_func field-{{ field.name }}-op'>
60                              {% field_function adminform.model_admin.model field %}&nbsp;</td>
61                          <td class='col_field field-{{ field.name }}-value'>{{ field.errors }}
62                          {{ field }}&nbsp;</td>
63                          {% if grouped %}
64                          <td class='field-{{ field.name }}-commonvalues'>
65                              {% link_fields_values grouped field.name %}
66                          </td>
67                          {% endif %}
68  
69                      </tr>
70                  {% endfor %}



/usr/local/lib/python3.8/site-packages/adminactions/mass_update.py, line 96, in get


89    def get_function(self, name):
90        return self.operations.get(name, None)
91
92    def get(self, field_class: type):
93        data = SortedDict()
94        # reversed to make the most specific overrule the more general ones
95        for typ in reversed(field_class.__mro__):
96            data |= self._dict.get(typ, ()) …
97        return data
98
99    def operation_enabled(self, field, operation):
100       if operation:
101           enabler = operation[2]
102           return enabler is True or (callable(enabler) and enabler(field))


Variable | Value
-- | --
data | OrderedDict()
field_class | <class 'django.db.models.fields.TextField'>
self | <adminactions.mass_update.OperationManager object at 0x7fb5940e2640>
typ | <class 'object'>

Resolved, updating docker's image from python 3.8 to 3.11 solved.