Skip to main content

Django Mixin allows easy import of files into Django models.

Project description

django-import-file

Not ready for use yet!

Developed by Jakub Jadczak, 2024

Examples of How To Use with Django Class Based View

Simple Usage

class ImportFile(FileImportMixin, FormView):

    model = RowsData

    form_class = ImportFileForm

    template_name = "main/home.html"

    file_extension = "csv"

    file_encoding = "utf-8"

    delimiter = ";"

    required_columns = ["name", "age", "email", "phone", "address"]

    messages_success = "Import successful with no errors."

    success_url = reverse_lazy("main:home")

With additional calculation method

class ImportFile(FileImportMixin, FormView):

    model = RowsData

    form_class = ImportFileForm

    template_name = "main/home.html"

    file_extension = "csv"

    file_encoding = "utf-8"

    delimiter = ";"

    required_columns = ["name", "age", "email", "phone", "address"]

    messages_success = "Import successful with no errors."

    success_url = reverse_lazy("main:home")



    def calculate_district(self, row):

        # name after _ must be equal to field in model, you want to calculate

        if ...:

            return "..."

        else:

            return "..."

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_import_file-0.0.5.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

django_import_file-0.0.5-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file django_import_file-0.0.5.tar.gz.

File metadata

  • Download URL: django_import_file-0.0.5.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.0

File hashes

Hashes for django_import_file-0.0.5.tar.gz
Algorithm Hash digest
SHA256 542187f0a5b7b9817a70889b751f6e0d0b625f1a834cc064e94fb93ebf0d0e4f
MD5 ba4aaa6f8a70642c38b744b1fd128f9f
BLAKE2b-256 2f44c15181eb1ad9014ac77e8a73f81b7fa64ff2a6659a5ff822e39bc157902c

See more details on using hashes here.

File details

Details for the file django_import_file-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for django_import_file-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 dfe7e9f12f9d345411e62103650977775e1dcad8f6e4a29b20f473a47f879465
MD5 38519e403d970c1d5cab090035e01090
BLAKE2b-256 70b09ae4bb9cd78d6bf8be2bccf0bb9763be39f3adee9771cc2046371a723e86

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page