anthony-tresontani / django-adaptors Goto Github PK
View Code? Open in Web Editor NEWConvert CSV/XML files into python object or django model
License: BSD 3-Clause "New" or "Revised" License
Convert CSV/XML files into python object or django model
License: BSD 3-Clause "New" or "Revised" License
Django-adaptors is a tool which allow you to transform easily a CSV/XML file into a python object or a django model instance. It is based on a django-style declarative model. More information available on read the doc: http://django-adaptors.readthedocs.org/ Release notes ------------- 0.2.5: - add DecimalField - lxml dependency optional
Hi,
I've noticed this project is not maintained anymore, besides forking and creating a django-adaptors-2
on PyPI what do you think about giving the project away to the community? We could create a organization, include you and other potential new contributors.
Thanks for your consideration.
I'm trying to use this app, but I couldn't found about how to set up a foreingkey field, can you help me please, ty
Version downloaded by pip from https://pypi.org/project/django-adaptors/
is not current one with support for pyton3
at line: https://github.com/anthony-tresontani/django-adaptors/blob/master/adaptor/model.py#L453
that should use a generator instead of a list
Can you add the ability to validate using a regex, eg::
XMLCharField(path='/some/path', regex='^Z[0,2]')
This is more flexible that offering choices.
I'm running the git-master version with django 1.8/python3 without problems for some time.
It would be nice to have a version 0.26 with the python3 patches included.
Thanks a lot!
in the fields.py
the method get_prep_value
contains the following code:
...
if not value and self.null and self.default is not None:
value = self.default
else:
value = self.to_python(value)
...
this generates an exception in the following scenario:
DateField
null=True
and has default=None
but I would expect it to not generate any exception: I simply desire to have a datefield which is null if not specified in the csv file. at the moment I patched the code as follows:
if not value and self.null:
value = self.default
else:
value = self.to_python(value)
which behaves as I expect. I thought you may desire to have it in your code, as I didn't find any other way to specify that a DateField can be optional in the csv file.
as i understand the exclude should be a list. but when i define the exclude = ['name1','name2'], error occurs as follows:
append() takes exactly one argument (2 given)
Exception Location: ...../lib/python2.7/site-packages/adaptor/model.py in get_exclusion_fields, line 312
i think the code should be changed to :
if hasattr(cls, "Meta") and hasattr(cls.Meta, "exclude"):
list_exclusion.extend(cls.Meta.exclude)
There doesn't appear to be a way to define namespaces for XPath, or to specify a root element that is namespaced, e.g.
<ns0:thing xmlns:ns0="http://example.com/blah" number="xxxx">
i think the docuement should be updated. DjangoModelField not mentidoned at the doc, bu instead of ForeignKey.
if a foreinkey definition can be NULL, how to deal with this secnario ?
maybe DjanogModelField.to_python() can be changed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.