1

I have code which uses form._raw_value(fieldname).

This is gone in Django 1.9.

Is there a way to access the raw value in 1.9+?

Update

I am only migrating the code to Django 1.9. Up to now I have no deeper understanding of what's going on there in detail.

guettli
  • 25,042
  • 81
  • 346
  • 663

1 Answers1

5

Looking at the source code, the _raw_value method is only 3 lines long, so it would be easy to add it as a function to your code.

def _raw_value(form, fieldname):
    field = form.fields[fieldname]
    prefix = form.add_prefix(fieldname)
    return field.widget.value_from_datadict(form.data, form.files, prefix)

Then change your code from form._raw_value(fieldname) to _raw_value(form, fieldname).

Alasdair
  • 298,606
  • 55
  • 578
  • 516