Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added CurrencyField and missing methods to add fields

  • Loading branch information...
commit cd9f4c4088a95a1ba8cc3b85ff93078fd885956d 1 parent e83103b
@fara fara authored
Showing with 19 additions and 3 deletions.
  1. +19 −3 passbook/models.py
View
22 passbook/models.py
@@ -83,9 +83,19 @@ def json_dict(self):
class NumberField(Field):
- def __init__(self, key, value, label='', numberStyle=NumberStyle.DECIMAL):
+ def __init__(self, key, value, label=''):
super(NumberField, self).__init__(key, value, label)
- self.numberStyle = numberStyle # Style of date to display
+ self.numberStyle = NumberStyle.DECIMAL # Style of date to display
+
+ def json_dict(self):
+ return self.__dict__
+
+
+class CurrencyField(NumberField):
+
+ def __init__(self, key, value, label='', currencyCode=''):
+ super(CurrencyField, self).__init__(key, value, label)
+ self.currencyCode = currencyCode # ISO 4217 currency code
def json_dict(self):
return self.__dict__
@@ -126,6 +136,9 @@ def __init__(self):
self.backFields = []
self.auxiliaryFields = []
+ def addHeaderField(self, key, value, label):
+ self.headerFields.append(Field(key, value, label))
+
def addPrimaryField(self, key, value, label):
self.primaryFields.append(Field(key, value, label))
@@ -135,6 +148,9 @@ def addSecondaryField(self, key, value, label):
def addBackField(self, key, value, label):
self.backFields.append(Field(key, value, label))
+ def addAuxiliaryField(self, key, value, label):
+ self.auxiliaryFields.append(Field(key, value, label))
+
def json_dict(self):
d = {}
if self.headerFields:
@@ -202,7 +218,7 @@ def __init__(self, passInformation, json='', passTypeIdentifier='', organization
self.teamIdentifier = teamIdentifier # Required. Team identifier of the organization that originated and signed the pass, as issued by Apple.
self.passTypeIdentifier = passTypeIdentifier # Required. Pass type identifier, as issued by Apple. The value must correspond with your signing certificate. Used for grouping.
self.organizationName = organizationName # Required. Display name of the organization that originated and signed the pass.
- self.serialNumber = '' # Required. Serial number that uniquely identifies the pass.
+ self.serialNumber = '' # Required. Serial number that uniquely identifies the pass.
self.description = '' # Required. Brief description of the pass, used by the iOS accessibility technologies.
self.formatVersion = 1 # Required. Version of the file format. The value must be 1.
Please sign in to comment.
Something went wrong with that request. Please try again.