Metadata-Version: 2.4
Name: django-rubble
Version: 0.7.1
Dynamic: Classifier
Summary: Extend django-model-utils and django-extensions.
Project-URL: changelog, https://github.com/WoosterTech/django-rubble/blob/main/CHANGELOG.md
Project-URL: documentation, https://woostertech.github.io/django-rubble/
Project-URL: issues, https://github.com/WoosterTech/django-rubble/issues
Project-URL: source, https://github.com/WoosterTech/django-rubble/
Author-email: Karl Wooster <karl@woostertech.com>
License-Expression: MIT
License-File: LICENSE
Keywords: django,django-extensions,django-model-utils
Requires-Python: <4.0,>=3.11
Requires-Dist: attrmagic>=0.2.0
Requires-Dist: case-converter<2.0.0,>=1.2.0
Requires-Dist: croniter>=3.0
Requires-Dist: django-model-utils>=4.5
Requires-Dist: django<5.3,>4
Requires-Dist: furl<3.0.0,>=2.1.3
Requires-Dist: levenshtein<0.27.0,>=0.26.1
Requires-Dist: loguru>=0.7
Requires-Dist: pydantic-settings>=2.7
Requires-Dist: pydantic>=2.7
Requires-Dist: toml<0.11.0,>=0.10.2
Requires-Dist: typing-extensions>=4.5; python_version < '3.12'
Provides-Extra: all
Requires-Dist: django-simple-history>=3.7; extra == 'all'
Requires-Dist: infisical-python>=2.3.5; extra == 'all'
Requires-Dist: neapolitan>=24.6; extra == 'all'
Requires-Dist: rich>=13.7; extra == 'all'
Requires-Dist: typer>=0.12; extra == 'all'
Provides-Extra: cli
Requires-Dist: rich>=13.7; extra == 'cli'
Requires-Dist: typer>=0.12; extra == 'cli'
Provides-Extra: history
Requires-Dist: django-simple-history>=3.7; extra == 'history'
Provides-Extra: neapolitan
Requires-Dist: neapolitan>=24.6; extra == 'neapolitan'
Provides-Extra: secrets
Requires-Dist: infisical-python>=2.3.5; extra == 'secrets'
Description-Content-Type: text/markdown

# 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/numeric_utils#django_rubble.utils.numeric_utils.is_number): checks if number could be coerced to a `float`
    - [`ratio_to_whole`](utils/numeric_utils#django_rubble.utils.numeric_utils.ratio_to_whole): .1 to 10; useful for percentages to "human"
    - [`whole_to_ratio`](utils/numeric_utils#django_rubble.utils.numeric_utils.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/)
