- licenses = set(
- (b.extra_info.get('license'), b.extra_info.get('license_description'))
- for b in Book.objects.all().iterator() if b.extra_info.get('license'))
+ licenses = set()
+ for b in Book.objects.all().iterator():
+ extra_info = b.get_extra_info_json()
+ if extra_info.get('license'):
+ licenses.add((extra_info.get('license'), extra_info.get('license_description')))