benjaoming/django-wiki — pull request #198 by TomLottermann (2013-09-27 23:07:32+00:00)
Title: Creating the index fails in special cases

I just noticed that the haystack index building fails in some cases.
I have an article without owner and group (which is allowed by the django-wiki models) and the index building fails with the following exception:

```
ERROR:root:Error updating wiki using default
Traceback (most recent call last):
File "/home/thomas/Dokumente/Softwareprojekte/campusshare2/ENV/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 210, in handle_label
self.update_backend(label, using)
File "/home/thomas/Dokumente/Softwareprojekte/campusshare2/ENV/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 256, in update_backend
do_update(backend, index, qs, start, end, total, self.verbosity)
File "/home/thomas/Dokumente/Softwareprojekte/campusshare2/ENV/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 78, in do_update
backend.update(index, current_qs)
File "/home/thomas/Dokumente/Softwareprojekte/campusshare2/ENV/local/lib/python2.7/site-packages/haystack/backends/elasticsearch_backend.py", line 155, in update
prepped_data = index.full_prepare(obj)
File "/home/thomas/Dokumente/Softwareprojekte/campusshare2/ENV/local/lib/python2.7/site-packages/haystack/indexes.py", line 196, in full_prepare
self.prepared_data = self.prepare(obj)
File "/home/thomas/Dokumente/Softwareprojekte/campusshare2/ENV/local/lib/python2.7/site-packages/haystack/indexes.py", line 187, in prepare
self.prepared_data[field.index_fieldname] = field.prepare(obj)
File "/home/thomas/Dokumente/Softwareprojekte/campusshare2/ENV/local/lib/python2.7/site-packages/haystack/fields.py", line 223, in prepare
return self.convert(super(IntegerField, self).prepare(obj))
File "/home/thomas/Dokumente/Softwareprojekte/campusshare2/ENV/local/lib/python2.7/site-packages/haystack/fields.py", line 97, in prepare
raise SearchFieldError("The model '%s' has an empty model_attr '%s' and doesn't allow a default or null value." % (repr(obj), attr))
SearchFieldError: The model '' has an empty model_attr 'group' and doesn't allow a default or null value.
SearchFieldError: The model '' has an empty model_attr 'group' and doesn't allow a default or null value.
```

My additions should fix that!

Cheers,
Thomas