djstripe.fields

dj-stripe Custom Field Definitions

FieldDeconstructMixin

IGNORED_ATTRS

attribute  IGNORED_ATTRS

deconstruct

deconstruct(self)

Remove field attributes that have nothing to do with the database. Otherwise unencessary migrations are generated.

JSONField

Bases: FieldDeconstructMixin, BaseJSONField

A field used to define a JSONField value according to djstripe logic.

PaymentMethodForeignKey

Bases: FieldDeconstructMixin, models.ForeignKey

StripeCurrencyCodeField

Bases: FieldDeconstructMixin, models.CharField

A field used to store a three-letter currency code (eg. usd, eur, ...)

StripeDateTimeField

Bases: FieldDeconstructMixin, models.DateTimeField

A field used to define a DateTimeField value according to djstripe logic.

stripe_to_db

stripe_to_db(self, data)

Convert the raw timestamp value to a DateTime representation.

StripeDecimalCurrencyAmountField

Bases: FieldDeconstructMixin, models.DecimalField

A legacy field to store currency amounts in dollars (etc).

Stripe is always in cents. Historically djstripe stored everything in dollars.

Note: Don't use this for new fields, use StripeQuantumCurrencyAmountField instead. We're planning on migrating existing fields in dj-stripe 3.0, see https://github.com/dj-stripe/dj-stripe/issues/955

stripe_to_db

stripe_to_db(self, data)

Convert the raw value to decimal representation.

StripeEnumField

Bases: FieldDeconstructMixin, models.CharField

enum

attribute  enum

deconstruct

deconstruct(self)

StripeForeignKey

Bases: models.ForeignKey

setting_name

attribute  setting_name

deconstruct

deconstruct(self)

get_default

get_default(self)

StripeIdField

Bases: FieldDeconstructMixin, models.CharField

A field with enough space to hold any stripe ID.

StripePercentField

Bases: FieldDeconstructMixin, models.DecimalField

A field used to define a percent according to djstripe logic.

StripeQuantumCurrencyAmountField

Bases: FieldDeconstructMixin, models.BigIntegerField

A field used to store currency amounts in cents (etc) as per stripe. By contacting stripe support, some accounts will have their limit raised to 11 digits, hence the use of BigIntegerField instead of IntegerField