django-rubble


Namedjango-rubble JSON
Version 0.6.0 PyPI version JSON
download
home_pagehttps://github.com/WoosterTech/django-rubble
SummaryExtend django-model-utils and django-extensions.
upload_time2024-09-17 17:47:30
maintainerNone
docs_urlNone
authorKarl Wooster
requires_python<4.0,>=3.10
licenseMIT
keywords django django-model-utils django-extensions
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-rubble

[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![image](https://img.shields.io/pypi/v/django-rubble.svg)](https://pypi.python.org/pypi/django-rubble)
[![image](https://img.shields.io/pypi/pyversions/django-rubble.svg)](https://pypi.python.org/pypi/django-rubble)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)


## Description

Extend [django-model-utils](https://github.com/jazzband/django-model-utils) and [django-extensions](https://github.com/django-extensions/django-extensions).

>Version 0.4.0 code got deleted but still exists on PyPI.

## Features

- Serialized Number Generation (e.g. PN-0001, PN-0001; MY1, MY2)
    - [`NumberedModel`](models/number_models#django_rubble.models.number_models.NumberedModel)
- Useful Model and Form fields
    - [`SimplePercentageField`](fields/db_fields#django_rubble.fields.db_fields.SimplePercentageField)
- Several Useful Utility Functions
    - [`is_number`](utils/numbers#django_rubble.utils.numbers.is_number): checks if number could be coerced to a `float`
    - [`ratio_to_whole`](utils/numbers#django_rubble.utils.numbers.ratio_to_whole): .1 to 10; useful for percentages to "human"
    - [`whole_to_ratio`](utils/numbers#django_rubble.utils.numbers.whole_to_ratio): 10 to .1; useful for "human" to "percentages"
    - perhaps others, see docs when they're published

## Installation

### From PyPI

`pip install django-rubble`

### From GitHub (for development)

1. Clone the repository: `git clone https://github.com/WoosterTech/django-rubble.git`
2. Install the dependencies: `poetry install`

## Usage

Simply use the functions, fields, models.

The biggest "gotcha" is that `NamedSerialNumber` needs to be imported in your `urls.py` file; not actually sure why, perhaps someone can help me with that?

To use the automatic numbering, subclass `NumberedModel` and make sure to include a `number_config = SerialNumberConfig(...)` attribute. It will set defaults, but just as a standard integer starting at "1" with no prefix.

```python
class PartNumber(NumberedModel):
    name = models.CharField("Part Description", max_length=100)
    number_config = SerialNumberConfig(
        initial_value=10, prefix="PN-", width=4
    )
```

Numbers will be generated starting with "PN-0010" (note the padding to make a width of 4) and increment by the default step of "1."


Contributions are welcome! Please follow the guidelines in [contributing](/contributing/)


This project is licensed under the [MIT License](LICENSE).

## Contact

- Author: Karl Wooster
- Email: <karl@woostertech.com>
- Website: [woostertech.com](https://woostertech.com)

## License

MIT (see [License](LICENSE))

## Contributing

See [contributing](/contributing/)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/WoosterTech/django-rubble",
    "name": "django-rubble",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "django, django-model-utils, django-extensions",
    "author": "Karl Wooster",
    "author_email": "karl@woostertech.com",
    "download_url": "https://files.pythonhosted.org/packages/17/d4/acaf9e8601e6eb91e55e1a6b5ac6bd351cc0fbc4657a59fce9a836a273b3/django_rubble-0.6.0.tar.gz",
    "platform": null,
    "description": "# django-rubble\n\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![image](https://img.shields.io/pypi/v/django-rubble.svg)](https://pypi.python.org/pypi/django-rubble)\n[![image](https://img.shields.io/pypi/pyversions/django-rubble.svg)](https://pypi.python.org/pypi/django-rubble)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n\n## Description\n\nExtend [django-model-utils](https://github.com/jazzband/django-model-utils) and [django-extensions](https://github.com/django-extensions/django-extensions).\n\n>Version 0.4.0 code got deleted but still exists on PyPI.\n\n## Features\n\n- Serialized Number Generation (e.g. PN-0001, PN-0001; MY1, MY2)\n    - [`NumberedModel`](models/number_models#django_rubble.models.number_models.NumberedModel)\n- Useful Model and Form fields\n    - [`SimplePercentageField`](fields/db_fields#django_rubble.fields.db_fields.SimplePercentageField)\n- Several Useful Utility Functions\n    - [`is_number`](utils/numbers#django_rubble.utils.numbers.is_number): checks if number could be coerced to a `float`\n    - [`ratio_to_whole`](utils/numbers#django_rubble.utils.numbers.ratio_to_whole): .1 to 10; useful for percentages to \"human\"\n    - [`whole_to_ratio`](utils/numbers#django_rubble.utils.numbers.whole_to_ratio): 10 to .1; useful for \"human\" to \"percentages\"\n    - perhaps others, see docs when they're published\n\n## Installation\n\n### From PyPI\n\n`pip install django-rubble`\n\n### From GitHub (for development)\n\n1. Clone the repository: `git clone https://github.com/WoosterTech/django-rubble.git`\n2. Install the dependencies: `poetry install`\n\n## Usage\n\nSimply use the functions, fields, models.\n\nThe biggest \"gotcha\" is that `NamedSerialNumber` needs to be imported in your `urls.py` file; not actually sure why, perhaps someone can help me with that?\n\nTo use the automatic numbering, subclass `NumberedModel` and make sure to include a `number_config = SerialNumberConfig(...)` attribute. It will set defaults, but just as a standard integer starting at \"1\" with no prefix.\n\n```python\nclass PartNumber(NumberedModel):\n    name = models.CharField(\"Part Description\", max_length=100)\n    number_config = SerialNumberConfig(\n        initial_value=10, prefix=\"PN-\", width=4\n    )\n```\n\nNumbers will be generated starting with \"PN-0010\" (note the padding to make a width of 4) and increment by the default step of \"1.\"\n\n\nContributions are welcome! Please follow the guidelines in [contributing](/contributing/)\n\n\nThis project is licensed under the [MIT License](LICENSE).\n\n## Contact\n\n- Author: Karl Wooster\n- Email: <karl@woostertech.com>\n- Website: [woostertech.com](https://woostertech.com)\n\n## License\n\nMIT (see [License](LICENSE))\n\n## Contributing\n\nSee [contributing](/contributing/)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Extend django-model-utils and django-extensions.",
    "version": "0.6.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/WoosterTech/django-rubble/issues",
        "Change Log": "https://github.com/WoosterTech/django-rubble/blob/main/CHANGELOG.md",
        "Documentation": "https://woostertech.github.io/django-rubble/",
        "Homepage": "https://github.com/WoosterTech/django-rubble",
        "Repository": "https://github.com/WoosterTech/django-rubble"
    },
    "split_keywords": [
        "django",
        " django-model-utils",
        " django-extensions"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2be21f1e7bc654346776a89fcea4e4afc79735c655c88b091fbf829e89436e5b",
                "md5": "eaa7511d1564c733861d1ac91c2f45d9",
                "sha256": "76821c725ddad74d9ef8bb6dfcb248fada8495330204782602bcec6f8520e6d7"
            },
            "downloads": -1,
            "filename": "django_rubble-0.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "eaa7511d1564c733861d1ac91c2f45d9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 24726,
            "upload_time": "2024-09-17T17:47:28",
            "upload_time_iso_8601": "2024-09-17T17:47:28.912484Z",
            "url": "https://files.pythonhosted.org/packages/2b/e2/1f1e7bc654346776a89fcea4e4afc79735c655c88b091fbf829e89436e5b/django_rubble-0.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "17d4acaf9e8601e6eb91e55e1a6b5ac6bd351cc0fbc4657a59fce9a836a273b3",
                "md5": "69c3509f218ea1596c21ac11e3a71db9",
                "sha256": "5b6a29145b88ebb07bf6f1c25cca16707c6c43e7abcd244275b7f4c8c990fcb9"
            },
            "downloads": -1,
            "filename": "django_rubble-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "69c3509f218ea1596c21ac11e3a71db9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 18707,
            "upload_time": "2024-09-17T17:47:30",
            "upload_time_iso_8601": "2024-09-17T17:47:30.542913Z",
            "url": "https://files.pythonhosted.org/packages/17/d4/acaf9e8601e6eb91e55e1a6b5ac6bd351cc0fbc4657a59fce9a836a273b3/django_rubble-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-17 17:47:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "WoosterTech",
    "github_project": "django-rubble",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "django-rubble"
}
        
Elapsed time: 1.23720s