https://github.com/apkawa/django-commission-field
Percentage or fixed commission/discount field with calculations
https://github.com/apkawa/django-commission-field
Last synced: 9 days ago
JSON representation
Percentage or fixed commission/discount field with calculations
- Host: GitHub
- URL: https://github.com/apkawa/django-commission-field
- Owner: Apkawa
- License: mit
- Created: 2018-04-27T17:01:21.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-01-23T13:05:12.000Z (over 6 years ago)
- Last Synced: 2025-10-28T17:59:51.648Z (9 months ago)
- Language: Python
- Size: 319 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pypi.python.org/pypi/django-commission-field)
[](https://travis-ci.org/Apkawa/django-commission-field)
[](https://pytest-ngrok.readthedocs.io/en/latest/?badge=latest)
[](https://codecov.io/gh/Apkawa/django-commission-field)
[](https://requires.io/github/Apkawa/django-commission-field/requirements/?branch=master)
[](https://pyup.io/repos/github/Apkawa/django-commission-field)
[](https://pypi.python.org/pypi/django-commission-field)
[](LICENSE)
# Installation
```bash
pip install django-commission-field
```
or from git
```bash
pip install -e git+https://githib.com/Apkawa/django-commission-field.git@master#egg=django-commission-field
```
## Django and python version
| Python
Django | 3.5 | 3.6 | 3.7 | 3.8 |
|:-----------------:|-----|-----|-----|-----|
| 1.8 | ✘ | ✘ | ✘ | ✘ |
| 1.11 | ✔ | ✔ | ✔ | ✘ |
| 2.2 | ✔ | ✔ | ✔ | ✔ |
| 3.0 | ✘ | ✔ | ✔ | ✔ |
# Usage
```python
from django.db import models
from commission_field.db.fields import CommissionField, CommissionTypeEnum
class ExampleModel(models.Model):
discount = CommissionField()
example = ExampleModel(discount_value=10, discount_type=CommissionTypeEnum.PERCENT)
assert example.discount.calculate_tax(1000) == 100
```