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.6.0.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

django_rubble-0.6.0-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_rubble-0.6.0.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Windows/11

File hashes

Hashes for django_rubble-0.6.0.tar.gz
Algorithm Hash digest
SHA256 5b6a29145b88ebb07bf6f1c25cca16707c6c43e7abcd244275b7f4c8c990fcb9
MD5 69c3509f218ea1596c21ac11e3a71db9
BLAKE2b-256 17d4acaf9e8601e6eb91e55e1a6b5ac6bd351cc0fbc4657a59fce9a836a273b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_rubble-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Windows/11

File hashes

Hashes for django_rubble-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76821c725ddad74d9ef8bb6dfcb248fada8495330204782602bcec6f8520e6d7
MD5 eaa7511d1564c733861d1ac91c2f45d9
BLAKE2b-256 2be21f1e7bc654346776a89fcea4e4afc79735c655c88b091fbf829e89436e5b

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