Git Product home page Git Product logo

xsd_to_django_model's People

Contributors

andykingking avatar bmampaey avatar drmattchristian avatar tuffnatty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

xsd_to_django_model's Issues

Make a pypi release

Looks like there hasn't been a release in a very long time, though you're up to 1.0.1

Can you do a release?

Missing `ndifflib` dependency in `setup.py`

Invoking xsd_to_django_model with Python 3.10.11:

Traceback (most recent call last):
  File "/Users/user/code/repo/venv/bin/xsd_to_django_model.py", line 42, in <module>
    import ndifflib
ModuleNotFoundError: No module named 'ndifflib'

Looks like ndifflib is not in install_requires of setup.py

types.xsd not found in schema

$> python xsd_to_django_model.py schema.xsd types.xsd
ERROR:__main__:EXCEPTION: types.xsd not found in schema

schema.xsd:
<xs:import namespace="types" schemaLocation="types.xsd"/>

NameError: name 'unicode' is not defined

Добрый день!

С помощью pip install xsd-to-django-model установил модуль
Вызываю его в терминале - получаю ошибку:

C:\Users\rusagm\Documents\PythonLibs\xsd_to_django_model-0.8.9\xsd_to_django_model-0.8.9\xsd_to_django_model>xsd_to_django_model.py C:\Users\rusagm\Documents\DOMRF\XMLSchemaPersonAdress.xsd Person
Traceback (most recent call last):
File "C:\Users\rusagm\Documents\PythonLibs\xsd_to_django_model-0.8.9\xsd_to_django_model-0.8.9\xsd_to_django_model\xsd_to_django_model.py", line 1812, in
builder.make_models([a.decode('UTF-8') for a in args['<xsd_type>']])
File "C:\Users\rusagm\Documents\PythonLibs\xsd_to_django_model-0.8.9\xsd_to_django_model-0.8.9\xsd_to_django_model\xsd_to_django_model.py", line 1812, in
builder.make_models([a.decode('UTF-8') for a in args['<xsd_type>']])
AttributeError: 'str' object has no attribute 'decode'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\rusagm\Documents\PythonLibs\xsd_to_django_model-0.8.9\xsd_to_django_model-0.8.9\xsd_to_django_model\xsd_to_django_model.py", line 1818, in
logger.error('EXCEPTION: %s', unicode(e))
NameError: name 'unicode' is not defined

Question: how to handle `maxOccurs=unbounded`?

Trying to run xsd_to_django_model on Cellosaurus version 7.00 with Python 3.11.7 and xsd_to_django_model==1.2.1:

> xsd_to_django_model.py cellosaurus.xsd /Cellosaurus
WARNING:__main__:Automatic model name: typename1. Consider adding it to TYPE_MODEL_MAP

Making model for type typename1
WARNING:__main__:Automatic model name: typename1.header. Consider adding it to TYPE_MODEL_MAP

 Making model for type typename1.header
WARNING:__main__:Automatic model name: typename1.header.release. Consider adding it to TYPE_MODEL_MAP

  Making model for type typename1.header.release
  Done making model typename1.header.release (typename1.header.release)
WARNING:__main__:Automatic model name: typename1.header.terminology-list. Consider adding it to TYPE_MODEL_MAP

  Making model for type typename1.header.terminology-list
WARNING:__main__:Automatic model name: typename1.header.terminology-list.terminology. Consider adding it to TYPE_MODEL_MAP

   Making model for type typename1.header.terminology-list.terminology
   Done making model typename1.header.terminology-list.terminology (typename1.header.terminology-list.terminology)
ERROR:__main__:EXCEPTION: caught maxOccurs=unbounded in typename1.header.terminology-list.terminology (@type=None). Consider adding it to many_to_many_fields, one_to_many_fields, array_fields, or json_fields
Traceback (most recent call last):
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1508, in make_a_field
    rel = model.get('foreign_key_overrides', {})[name]
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'header'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1508, in make_a_field
    rel = model.get('foreign_key_overrides', {})[name]
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'terminology-list'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 2244, in main
    builder.make_models([(a.decode('UTF-8') if hasattr(a, 'decode') else a)
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1860, in make_models
    self.make_model('typename1', self.schema.elements[typename[1:]].type)
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1799, in make_model
    self.write_seq_or_choice(seq_or_choice, typename, attrs=attrs)
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1179, in write_seq_or_choice
    self.make_fields(typename, seq_or_choice,
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1635, in make_fields
    **self.make_a_field(typename, name, dotted_name,
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1510, in make_a_field
    final_type, field = self.get_field(final_type,
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1004, in get_field
    self.make_model(el_path, element.type)
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1799, in make_model
    self.write_seq_or_choice(seq_or_choice, typename, attrs=attrs)
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1179, in write_seq_or_choice
    self.make_fields(typename, seq_or_choice,
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1635, in make_fields
    **self.make_a_field(typename, name, dotted_name,
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1510, in make_a_field
    final_type, field = self.get_field(final_type,
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1004, in get_field
    self.make_model(el_path, element.type)
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1799, in make_model
    self.write_seq_or_choice(seq_or_choice, typename, attrs=attrs)
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1179, in write_seq_or_choice
    self.make_fields(typename, seq_or_choice,
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1635, in make_fields
    **self.make_a_field(typename, name, dotted_name,
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1568, in make_a_field
    (max_occurs == 1) or (field.get('wrap') == "ArrayField"), (
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: caught maxOccurs=unbounded in typename1.header.terminology-list.terminology (@type=None). Consider adding it to many_to_many_fields, one_to_many_fields, array_fields, or json_fields

It looks like it encountered terminology-list's definition's maxOccurs=unbounded.

What should one do for maxOccurs=unbounded?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.