Skip to main content

PyPi Build Status codecov Requirements Status PyUP PyPI License

Installation

pip install django-import-path-field

or from git

pip install -e git+https://githib.com/Apkawa/django-import-path-field.git#egg=django-import-path-field

Django and python version

Python
Django
3.5 3.6 3.7 3.8
1.8 ✘ ✘ ✘ ✘
1.11 ✔ ✔ ✔ ✘
2.2 ✔ ✔ ✔ ✔
3.0 ✘ ✔ ✔ ✔

Usage

models.py

from django.db import models
from importpath_field import ImportPathField, ImportPathChoices


class DescriptionClassStrategy:
    # Description for class
    short_description = 'Strategy description'

    @classmethod
    def class_method(cls):
        return 1

    @classmethod
    def class_method_description(cls):
        """Class method description"""
        return 1

    def method(self):
        return 3


def example_function_description():
    return 1

# Can description for choice
example_function_description.short_description = 'Function description'


IMPORT_CHOICES = ImportPathChoices(
    DescriptionClassStrategy, 
    example_function_description,
)

# Also may add to choice 
@IMPORT_CHOICES.register("Example description")
def example_function():
    return 1


class ExampleModel(models.Model):
    example_class = ImportPathField()
    example_class_choices = ImportPathField(choices=IMPORT_CHOICES)
    example_class_null = ImportPathField(null=True, blank=True)
</code></pre>
<h1><a href="#user-content-contributing" aria-hidden="true" class="anchor" id="user-content-contributing"></a>Contributing</h1>
<h2><a href="#user-content-run-example-app" aria-hidden="true" class="anchor" id="user-content-run-example-app"></a>run example app</h2>
<pre><code class="language-bash">pip install -r requirements-dev.txt
./test/manage.py migrate
./test/manage.py runserver

run tests

pip install -r requirements-dev.txt
pytest
tox

Update version

python setup.py bumpversion

publish pypi

python setup.py publish

Metadata

Release files for django-import-path-field 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-import-path-field 0.0.2
File Size Uploaded
django-import-path-field-0.0.2.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-import-path-field 0.0.2
File Interpreter ABI Platform
django_import_path_field-0.0.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 12.7 kB

Release files / django-import-path-field-0.0.2.tar.gz

Download URL django-import-path-field-0.0.2.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3e923c467407ddc20e6e591cfd9b1aaf996f3b30f0cf1fb9c904792f6f359279
BLAKE2b-256 checksum
How to use checksums
eded0b2e5da3dcf029df2686fcd63f46c3ef76747cf8f7a4234885537efc4976
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3

Release files / django_import_path_field-0.0.2-py2.py3-none-any.whl

Download URL django_import_path_field-0.0.2-py2.py3-none-any.whl
Size 7.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1ff2a529ea8a0a4592168ae83f0d7c2f1d4dd144c930bf2def1eaac1a877b332
BLAKE2b-256 checksum
How to use checksums
c13b2b0790d23eceeb41f196e110c0b86b60baf30fbb42bfab94b701f83b9e97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page