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.8python
>= 3
Quickstart
Install django-credit-cards:
pip install django-credit-cards
Then add it to your models:
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:
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
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 BSD 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 Distribution
Built Distribution
File details
Details for the file django-credit-cards-0.4.1.tar.gz
.
File metadata
- Download URL: django-credit-cards-0.4.1.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9c51399b718375cbddee18c13559de154c8de1b1cae4ae9e5db29d5df258bff |
|
MD5 | d2c892831e348c53b96bcf4ee3ef64e2 |
|
BLAKE2b-256 | f4878c1d328b8451d7a7b7abd492c9f093153aba35d957a70eb5b95ad29058b5 |
File details
Details for the file django_credit_cards-0.4.1-py2.py3-none-any.whl
.
File metadata
- Download URL: django_credit_cards-0.4.1-py2.py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63f651070d556689d57907d49a5fd6a12df698db303665c0daebdcefc34abe96 |
|
MD5 | a8459a23db071a9d12686bef026d8d92 |
|
BLAKE2b-256 | a1cfd23dcb1a7631cd0c3339c4be08ccb74feff46137c06e794f9ce70d46375f |