GithubHelp home page GithubHelp logo

isabella232 / django-simple-import Goto Github PK

View Code? Open in Web Editor NEW

This project forked from burke-software/django-simple-import

0.0 0.0 0.0 278 KB

An import tool easy enough your users could use it

License: Other

Python 89.18% HTML 10.51% Dockerfile 0.31%

django-simple-import's Introduction

django-simple-import

An easy to use import tool for Django. django-simple-import aims to keep track of logs and user preferences in the database.

Project is now stable and in maintenance only mode. If you'd like to add features please fork or take over ownership.

Changelog

2.1

  • Add support for Django 2.2 and 3.0
  • Move to gitlab and gitlab CI for freedom and consistency with other Burke Software maintained projects

2.0

2.0 adds support for Django 1.9 and 1.10. Support for 1.8 and under is dropped. Support for Python 2 is dropped. Removed support for django-custom-field Use 1.x for older environments.

1.17

The most apparent changes are 1.7 compatibility and migration to Django's atomic transactions. Please report any issues. I test against mysql innodb, postgres, and sqlite.

Features

  • Supports csv, xls, xlsx, and ods import file
  • Save user matches of column headers to fields
  • Guess matches
  • Create, update, or both
  • Allow programmers to define special import methods for custom handling
  • Set related objects by any unique field
  • Simulate imports before commiting to database
  • Undo (create only) imports
  • Security checks if user has correct permissions (partially implemented)

Install

  1. pip install django-simple-import[ods,xls,xlsx] for full install or specify which formats you need to support. CSV is supported out of box.
  2. Add 'simple_import' to INSTALLED APPS
  3. Add simple_import to urls.py like url(r'^simple_import/', include('simple_import.urls')),
  4. migrate

Optional Settings

Define allowed methods to be "imported". Example:

class Foo(models.Model):
    ...
    def set_bar(self, value):
        self.bar = value
    simple_import_methods = ('set_bar',)

settings.py

SIMPLE_IMPORT_LAZY_CHOICES: Default True. If enabled simple_import will look up choices when importing. Example:

choices  = ['M', 'Monday']

If the spreadsheet value is "Monday" it will set the database value to "M."

SIMPLE_IMPORT_LAZY_CHOICES_STRIP: Default False. If enabled, simple_import will trip leading/trailing whitespace from the cell's value before checking for a match. Only relevant when SIMPLE_IMPORT_LAZY_CHOICES is also enabled.

If you need any help, we do consulting and custom development. Just email us at david at burkesoftware.com.

Usage

Go to /simple_import/start_import/ or use the admin interface.

The screenshots have a django-grappelli like theme. The base templates have no style and are very basic. See an example of customization here. It is often sufficient to simply override simple_import/templates/base.html.

There is also a log of import records. Check out /admin/simple_import/.

Odd Things

Added a special set password property on auth.User to set password. This sets the password instead of just saving a hash.

User has some required fields that...aren't really required. Hardcoded to let them pass.

Security

I'm working on the assumption staff users are trusted. Only users with change permission to a field will see it as an option. I have not spent much time looking for ways users could manipulate URLs to run unauthorized imports. Feel free to contribute changes. All import views do require admin "is staff" permission.

Testing

If you have docker-compose and Docker installed, then just running docker-compose run --rm app ./manage.py test will do everything you need to test the packages.

Otherwise look at the .travis.yml file for test dependencies.

django-simple-import's People

Contributors

bufke avatar cordavis avatar smcoll avatar saulshanabrook avatar seanhayes avatar matthiaswh avatar

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.