Skip to main content

No project description provided

Project description

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>Contributing</h1>
<h2>run example app</h2>
<pre lang="bash"><code>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

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-path-field-0.0.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

django_import_path_field-0.0.2-py2.py3-none-any.whl (7.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-import-path-field-0.0.2.tar.gz.

File metadata

  • Download URL: django-import-path-field-0.0.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for django-import-path-field-0.0.2.tar.gz
Algorithm Hash digest
SHA256 3e923c467407ddc20e6e591cfd9b1aaf996f3b30f0cf1fb9c904792f6f359279
MD5 9f197e73086ad4775bf4af4248712d7a
BLAKE2b-256 eded0b2e5da3dcf029df2686fcd63f46c3ef76747cf8f7a4234885537efc4976

See more details on using hashes here.

File details

Details for the file django_import_path_field-0.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: django_import_path_field-0.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using 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

File hashes

Hashes for django_import_path_field-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1ff2a529ea8a0a4592168ae83f0d7c2f1d4dd144c930bf2def1eaac1a877b332
MD5 f5725bb77724f06c84ce1a9720903b39
BLAKE2b-256 c13b2b0790d23eceeb41f196e110c0b86b60baf30fbb42bfab94b701f83b9e97

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