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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_import_file-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 b25b2a31f5978ee237c85b76e9bf8874a07c4e7e05399542f41257562d241786
MD5 0aeb7451dc61bb37a3e62029ac10d546
BLAKE2b-256 0601faef0661e70f00f96dbefc511964c35e02764e74bea8e7d44a3a1b2bc214

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_import_file-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f7659f0e27e3e21a1a30a74a133172044e01584907dbf6df17098ffc9c6e5f9d
MD5 af133d028578b4eedc1eaa444277c27e
BLAKE2b-256 433fc1230a614751e74c27a07c4019eb39e40a2a595c86444274223853f3e48e

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