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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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