Skip to content

Commit

Permalink
Version bump to 0.8.7; allow plain_index_fields including unique_fiel…
Browse files Browse the repository at this point in the history
  • Loading branch information
tuffnatty committed Apr 27, 2018
1 parent 652745c commit d5efad1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion xsd_to_django_model/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.8.6'
__version__ = '0.8.7'
8 changes: 5 additions & 3 deletions xsd_to_django_model/xsd_to_django_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,9 @@ def build_code(self):
['GinIndex(["%s"])' % f
for f in model_options.get('gin_index_fields', [])] + \
['models.Index(["%s"])' % f
for f in model_options.get('plain_index_fields', [])]
for f in list(set(model_options.get('plain_index_fields', [])) -
set(model_options.get('unique_fields', [])))
if f != model_options.get('primary_key')]
if indexes:
meta.append('indexes = [\n %s\n ]'
% ',\n '.join(sorted(indexes)))
Expand Down Expand Up @@ -1100,7 +1102,7 @@ def make_a_field(self, typename, name, dotted_name,
o['null'] = null or get_null(el_def)
simpletype_base = self.flatten_ct(ct2_def, typename, **o)
if not simpletype_base:
return
return {}
el_type = simpletype_base
else:
logger.warning('complexType not found'
Expand Down Expand Up @@ -1215,7 +1217,7 @@ def make_a_field(self, typename, name, dotted_name,
this_model.number_field = name
elif match(name, model, 'unique_fields'):
options.append('unique=True')
elif match(name, model, 'index_fields'):
if match(name, model, 'index_fields'):
options.append('db_index=True')
elif (match(name, model, 'gin_index_fields') or
match(name, model, 'plain_index_fields')):
Expand Down

0 comments on commit d5efad1

Please sign in to comment.