Code Monkey home page Code Monkey logo

amount_field's Introduction

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!

amount_field's People

Contributors

syedmaazhassan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.