pivotal-energy-solutions/django-datatable-view

GenericIPAddressField

marquicus opened this issue · 1 comments

Hello
Where trying to render a table with a GenericIPAddressField, thank you in advance

File "/home/marp/.virtualenvs/nomconsole/lib/python3.6/site-packages/datatableview/datatables.py", line 164, in new
opts.processors, opts.unsortable_columns, opts.hidden_columns)
File "/home/marp/.virtualenvs/nomconsole/lib/python3.6/site-packages/datatableview/datatables.py", line 53, in columns_for_model
raise ColumnError("Unhandled model field %r." % (f,))
datatableview.exceptions.ColumnError: Unhandled model field <django.db.models.fields.GenericIPAddressField: ipaddr>.

Hi,

I think the fix is to modify columns.py, add GenericIPAddressField in handle_field_classes.

class TextColumn(Column):
model_field_class = models.CharField
handles_field_classes = [models.CharField, models.TextField, models.FileField,
models.GenericIPAddressField]

Kind Regards,