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.3.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_import_file-0.0.3.tar.gz
  • Upload date:
  • Size: 4.4 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.3.tar.gz
Algorithm Hash digest
SHA256 364f3d2db09bb4ab147aadb8f473c7f964ec9257a3876328121282013b968b56
MD5 89514c50da21174ead677d39d85b18ad
BLAKE2b-256 3be09006f09bf4022d4fb7488ef2c3775910f9d824131e8520284c5a34edd141

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_import_file-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fcf07c5c61b2b5426d73d95863951db9882021adf0b641135bb413400d819469
MD5 d54404463b897da64e1cded74f755d20
BLAKE2b-256 9f3b07103e552e6061cf77fddb16a2f133b79ae12263c48121af17af4c927244

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