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.1.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.1-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_rubble-0.8.1.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.1.tar.gz
Algorithm Hash digest
SHA256 ad8253f20d891876581fcdcd4d372abe019f891a7eb5bace3f4874eb228e462e
MD5 86f5862e967b7579429723972284092d
BLAKE2b-256 ada60c1e7681a2ed17446ec57f9d9006a660ff8ed7b9243f2baa4b22a5d84282

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_rubble-0.8.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c82a334120c414f2e74ff625bf13675fa7ca80acc7a68fffa29f0972b9eff5e
MD5 5f63b08e01430648c48b14e88952e71e
BLAKE2b-256 cb7598f421af637a3e531fb1950a9142c08e3071530e41af042a9bb7f08afdcc

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