A Django app providing database and form fields for credit cards.
Project description
# django-credit-cards
A Django app providing database and form fields for credit cards.
## Compatibility
* `django` >= 1.8
* `python` >= 3
## Quickstart
Install django-credit-cards:
```bash
pip install django-credit-cards
```
Then add it to your models:
```python
from creditcards.models import CardNumberField, CardExpiryField, SecurityCodeField
class Payment(models.Model):
cc_number = CardNumberField(_('card number'))
cc_expiry = CardExpiryField(_('expiration date'))
cc_code = SecurityCodeField(_('security code'))
```
Or to your forms:
```python
from creditcards.forms import CardNumberField, CardExpiryField, SecurityCodeField
class PaymentForm(forms.Form):
cc_number = CardNumberField(label='Card Number')
cc_expiry = CardExpiryField(label='Expiration Date')
cc_code = SecurityCodeField(label='CVV/CVC')
```
### Credit Card Type Detection
```python
from creditcards import types
assert types.get_type('4444333322221111') == types.CC_TYPE_VISA
assert types.get_type('343434343434343') == types.CC_TYPE_AMEX
assert types.get_type('0000000000000000') == types.CC_TYPE_GENERIC
```
## License
Copyright (c) 2018 Mihail Mishakin Released under the MIT license (see LICENSE)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for django_credit_cards-0.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e19523cb420cb8e0a8793f780082091e90adf30401d3c71b18fc2e2ea210909b |
|
MD5 | 1869b26af44765fb74ffbef2fe5e7d50 |
|
BLAKE2b-256 | 8276e7f6c64a01e8ad1754ad74327940a73e9af0d431a13de68117bc02d68c01 |