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.8.2.tar.gz (101.6 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.8.2-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_rubble-0.8.2.tar.gz
  • Upload date:
  • Size: 101.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"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.8.2.tar.gz
Algorithm Hash digest
SHA256 7fa86783c1a2323696155e75da729aeb1f6da7ec02e2fd2b9017ad65f2f54f6f
MD5 dbafa7d46a46529aef5499bd52408231
BLAKE2b-256 6bc91078646340345ceebc99548ea00976ff53ecdfcdd4bed076b9bd525abbdb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_rubble-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 31.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"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.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a26ff69045a890e31683c913b063e4c2ac79d5e9f93d53a5b6fb4086803987b5
MD5 073aaba9601214f0efd9df61fbf56d52
BLAKE2b-256 f9e7369533ef41fdc6e6158fd6ee17b96044f2f2d08efd56cab3c728dcc30582

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