Metadata-Version: 2.1
Name: django-rubble
Version: 0.5.2
Summary: Extend django-model-utils and django-extensions.
Home-page: https://github.com/WoosterTech/django-rubble
License: MIT
Keywords: django,django-model-utils,django-extensions
Author: Karl Wooster
Author-email: karl@woostertech.com
Requires-Python: >=3.10,<4.0
Classifier: Framework :: Django :: 4
Classifier: Framework :: Django :: 4.0
Classifier: Framework :: Django :: 4.1
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.0
Classifier: Framework :: Django :: 5.1
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Provides-Extra: project
Requires-Dist: croniter (>=3.0.3,<4.0.0)
Requires-Dist: django (>4,<5.3)
Requires-Dist: django-model-utils (>=4.5.1,<5.0.0)
Requires-Dist: loguru (>=0.7.2,<0.8.0)
Requires-Dist: neapolitan (>=24.6,<25.0) ; extra == "project"
Requires-Dist: pydantic (>=2.6.4,<3.0.0)
Project-URL: Bug Tracker, https://github.com/WoosterTech/django-rubble/issues
Project-URL: Change Log, https://github.com/WoosterTech/django-rubble/blob/main/CHANGELOG.md
Description-Content-Type: text/markdown

# 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)
- Useful Model and Form fields
  - `SimplePercentageField`
- Several Useful Utility Functions
  - `is_number`: checks if number could be coerced to a `float`
  - `ratio_to_whole`: .1 to 10; useful for percentages to "human"
  - `whole_to_ration`: 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.md](CONTRIBUTING.md).


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.md](CONTRIBUTING.md)

