Skip to main content

A Django app for handling amounts, currencies, and prices

Project description

amount_field

amount_field is a Django app designed to facilitate projects dealing with amounts, currencies, and prices. It provides custom Django model and form fields for handling amounts, along with functionality to format currency with commas for thousands and add commas while typing currency in inputs.

Features

  • AmountField: A custom Django model field for storing amounts.
  • AmountFormField: A custom Django form field for handling amounts in forms.
  • Custom template tag: Provides a custom template tag for formatting currency with commas for thousands.
  • Real-time formatting: Automatically adds commas while typing currency in inputs.

Installation

You can install amount_field via pip:

pip install amount-field

Usage

  1. Model Field:

    from django.db import models
    from amount_field.models import AmountField
    
    class YourModel(models.Model):
        amount = AmountField()
    
  2. Form Field:

    from django import forms
    from amount_field.forms import AmountFormField
    
    class YourForm(forms.Form):
        amount = AmountFormField()
    
  3. Template Tag:

    {% load amount_tags %}
    {{ amount_value|format_currency }}
    

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License.

Feel free to copy and paste this content into your README.md file and make any necessary adjustments. Let me know if you need further assistance!

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

amount-field-0.1.0.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

amount_field-0.1.0-py3-none-any.whl (2.1 kB view details)

Uploaded Python 3

File details

Details for the file amount-field-0.1.0.tar.gz.

File metadata

  • Download URL: amount-field-0.1.0.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.9

File hashes

Hashes for amount-field-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ae82e8b0ce8f267496d81556983c9c7312aa0805df7ed1d1053d9ca408230b12
MD5 54d8f6d8b1dc76d37898ca12a7d5d2a3
BLAKE2b-256 3ac0f228e25b4a8391195a656088c792f8c2405325b269e0144773eb1e819815

See more details on using hashes here.

File details

Details for the file amount_field-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for amount_field-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 812163a571b3b165da22c78179ee03ab810f81a1f23d2f174b38536487e03bed
MD5 75fb05db1e5051f96e8b799dcd89ea8c
BLAKE2b-256 8ec453a6ae8026005fa8423c104a406f40d69ca81cce54bf001de5e7c98bed67

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