Skip to main content

Extend django-model-utils and django-extensions.

Project description

django-rubble

Ruff image image License

Description

Extend django-model-utils and 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
  • 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_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.

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

This project is licensed under the MIT License.

Contact

License

MIT (see License)

Contributing

See contributing

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_rubble-0.7.1.tar.gz (110.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_rubble-0.7.1-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

Details for the file django_rubble-0.7.1.tar.gz.

File metadata

  • Download URL: django_rubble-0.7.1.tar.gz
  • Upload date:
  • Size: 110.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for django_rubble-0.7.1.tar.gz
Algorithm Hash digest
SHA256 238cf200c0444eefa9981ecb1ecf3d3a286248ce3c4291e6c434ce7b1df467f0
MD5 fd3c79d2f3c297890ee5cc9fa1362c51
BLAKE2b-256 04af40633c1ee83d8b3ad001c5d8b4a3d441f96961e6e824cf34cb041cf7b8b8

See more details on using hashes here.

File details

Details for the file django_rubble-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: django_rubble-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 30.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for django_rubble-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d4e2ef9e2611a629a895fa70b5a67c750e5cc8f1d54f4d6a57d6313df6c885d8
MD5 d6988ee320b7c3abade7010ade038bb7
BLAKE2b-256 6d504b58e4d06c9bb170f56e2197cae1d225353acdf0635e39980f4834c7e0da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page