Shane,

Thanks for catching this issue.

I've added the following simple types to those supported by the
Django code generator: xsd:gYear, xsd:gYearMonth, xsd:gMonth,
xsd:gMonthDay, and xsd:gDay.  Each of these XML schema simple types
will generate:

  - django.db.models.DateField (in the generated Django  models module)
  - django.forms.DateField (in the generated Django forms module)

Django does not have more specific types for year, year-month,
month, month-day, and day that I could find.  If you find them, let
me know.

I've also added the xsd:time simple type so that the XML schema simple
types xsd:dateTime and xsd:time generate the Django DateTimeField and
TimeField respectively.

You can look at the following for information on XML schema simple
types: https://www.w3.org/TR/xmlschema-0/#SimpleTypeFacets

If you spot additional simple types in that table that you feel we
should also support, but do not, let me know.

I've pushed this change to the Bitbucket repository at:
https://bitbucket.org/dkuhlman/generateds.  And, I've attached a
distribution file in a separate email.

I've attached the XML schema file that I used for my tests.  You can
run it with any of the following command lines:

    $ python gends_run_gen_django.py test01.xsd
    $ python gends_run_gen_django.py --force test01.xsd
    $ python3 gends_run_gen_django.py test01.xsd
    $ python3 gends_run_gen_django.py --force test01.xsd

Dave

On Wed, Jan 04, 2017 at 08:44:25PM -0500, Shane Rigby wrote:
>    Thanks Dave,
> 
>    That's great - I really appreciate it.
> 
>    That is now running through now, but I get an warning/error where my
>    schema uses a type of gYear
>    (http://www.datypic.com/sc/xsd/t-xsd_gYear.html) and it gives a
>    warning/error of "Unhandled simple type: Year gYear". Is this a known
>    limitation?
> 
>    Cheers,
> 
>    Shane
>    On Wed, Jan 4, 2017 at 1:01 PM, Dave Kuhlman <dkuhl...@davekuhlman.org>
>    wrote:
> 
>      Shane,
> 
>      My testing shows that the Django support now runs under both Python 2
>      and Python 3.
> 
>      I've attached a distribution file containing these fixes in a
>      separate email.  You can also find the Mercurial repository with
>      these fixes at: https://bitbucket.org/dkuhlman/generateds
> 
>      If and when you try it, please let me know about the results, and
>      about any other suggestions and ideas you have on generateDS, too.
> 
>      If you have not seen it already, take a look at:
>      
> http://www.davekuhlman.org/generateDS.html#django-generating-models-and-forms
> 
>      And, the gends_run_gen_django.py script, which automates the
>      generation process, may be helpful, too.
>      Dave
> 
>      On Mon, Jan 02, 2017 at 06:20:54PM -0500, Shane Rigby wrote:
>      >    Hi Dave,
>      >
>      >    That's awesome!
>      >
>      >    I look forward to hearing further from you - I'm running a docker
>      >    container on hyper.sh that contains a gitlab runner (our schema
>      is in
>      >    GitLab) that automatically generates the python classes using
>      GenerateDS
>      >    so I can quickly create test case xmls from Excel. If I can get
>      the Django
>      >    part working, I'd like to auto-deploy the whole shebang!  It
>      would be
>      >    really neat.
>      >
>      >    Anyway, let me know if you want me to test anything - happy to
>      help in any
>      >    way I can.
>      >    On Mon, Jan 2, 2017 at 4:59 PM, Dave Kuhlman
>      <dkuhl...@davekuhlman.org>
>      >    wrote:
>      >
>      >      Shane,
>      >
>      >      Good to hear from you.  Sounds like you are doing some
>      interesting
>      >      work with XML.
>      >
>      >      Thanks for reporting the problems which the Django support and
>      >      Python 3.  I'll look into that.
>      >
>      >      OK.  I've done a little work on the Python 3 support for
>      Django.  I
>      >      got the modules that generate the Django code to run
>      successfully
>      >      under both Python 2 and Python 3.  And, I believe that the
>      generated
>      >      files (models.py, forms.py, and admin.py), themselves are
>      Python 3
>      >      compatible.  Give me a little time to do some more checking
>      and then
>      >      I'll
>      >      pass them along to you, hopefully tomorrow (my time/date in
>      >      California, U.S.A).
>      >
>      >      About whether I know of anyone working in this area, I'm not
>      sure
>      >      what you mean by "this area".  If you mean using the Django
>      support
>      >      provided by generateDS, I usually only get reports when
>      something is
>      >      not working.  I've had several of those in the past, and have
>      been
>      >      able to fix the reported problems.  But I don't know where
>      those
>      >      projects went after that.
>      >
>      >      More later when I have a fix for you.
>      >
>      >      Dave
>      >
>      >      On Sat, Dec 31, 2016 at 10:20:33AM -0500, Shane Rigby wrote:
>      >      > Hi Dave,
>      >      >
>      >      > I work for a LIXI a non-profit in Australia that manages the
>      xml data
>      >      > standards that are used widely for applying for residential
>      mortgages
>      >      in
>      >      > Australia. Simply put, we publish xsd schema for our members
>      to use to
>      >      > transmit credit applications to each other.
>      >      >
>      >      > I've been learning python and trying out your project
>      GenerateDS to
>      >      > generate python code to create and read messages. I've been
>      trying to
>      >      get
>      >      > the Django model generation working but notice there is some
>      Python2
>      >      > specific code that is causing me problems (I'm using
>      Python3).
>      >      >
>      >      > Do you know if anyone is working in this area?
>      >      >
>      >      > I'm really new to open-source and trying to figure out how
>      to best
>      >      > contribute (I'm really pretty new to Python).
>      >      >
>      >      > Cheers,
>      >      >
>      >      > Shane
>      >
>      >      --
>      >
>      >      Dave Kuhlman
>      >      http://www.davekuhlman.org
> 
>      --
> 
>      Dave Kuhlman
>      http://www.davekuhlman.org

-- 

Dave Kuhlman
http://www.davekuhlman.org
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
    >

    <xsd:element name="container" type="ContainerType" />

    <xsd:complexType name="ContainerType">
        <xsd:sequence>
            <xsd:element name="field01" type="ST1" maxOccurs="unbounded" />
            <xsd:element name="dateTime01" type="xsd:dateTime" />
            <xsd:element name="dateTime02" type="xsd:date" />
            <xsd:element name="dateTime03" type="xsd:time" />
            <xsd:element name="dateTime04" type="xsd:gYear" />
            <xsd:element name="dateTime05" type="xsd:gYearMonth" />
            <xsd:element name="dateTime06" type="xsd:gMonth" />
            <xsd:element name="dateTime07" type="xsd:gMonthDay" />
            <xsd:element name="dateTime08" type="xsd:gDay" />
        </xsd:sequence>
    </xsd:complexType>

    <xsd:simpleType name="ST1">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="abcd|ef\|gh" />
        </xsd:restriction>
    </xsd:simpleType>

</xsd:schema>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to