예제 #1
0
class Contact(models.Model):
    is_deleted = models.BooleanField(verbose_name='Deleted',
                                     sf_read_only=models.READ_ONLY)
    master_record = models.ForeignKey('self',
                                      models.DO_NOTHING,
                                      related_name='contact_masterrecord_set',
                                      sf_read_only=models.READ_ONLY,
                                      blank=True,
                                      null=True)
    account = models.ForeignKey(
        Account,
        models.DO_NOTHING,
        blank=True,
        null=True,
        related_name='contacts',
        related_query_name='contact')  # Master Detail Relationship *
    last_name = models.CharField(max_length=80)
    first_name = models.CharField(max_length=40, blank=True, null=True)
    salutation = models.CharField(max_length=40,
                                  choices=[('Mr.', 'Mr.'), ('Ms.', 'Ms.'),
                                           ('Mrs.', 'Mrs.'), ('Dr.', 'Dr.'),
                                           ('Prof.', 'Prof.')],
                                  blank=True,
                                  null=True)
    name = models.CharField(max_length=121,
                            verbose_name='Full Name',
                            sf_read_only=models.READ_ONLY)
    email = models.EmailField(blank=True, null=True)
    used_by_e_commerce = models.BooleanField(default=True,
                                             custom=True,
                                             db_column='Used_by_eCommerce__c',
                                             max_length=255,
                                             verbose_name='Used by eCommerce')
예제 #2
0
class Opportunity(models.Model):
    """Model that maps to Salesforce Opportunity object."""

    account = models.ForeignKey(Account,
                                models.DO_NOTHING,
                                blank=True,
                                null=True)
    name = models.CharField(max_length=120)
    stage_name = models.CharField(max_length=40, verbose_name='Stage')
    amount = models.DecimalField(max_digits=18,
                                 decimal_places=2,
                                 blank=True,
                                 null=True)
    close_date = models.DateField(verbose_name='Close Date')
    paid_date = models.DateField(db_column='Paid_Date__c',
                                 custom=True,
                                 verbose_name='Paid Date')
    campaign = models.ForeignKey(Campaign,
                                 models.DO_NOTHING,
                                 blank=True,
                                 null=True)

    class Meta(models.Model.Meta):
        db_table = 'Opportunity'
        verbose_name = 'Opportunity'
        verbose_name_plural = 'Opportunities'

    def __unicode__(self):
        """Return unicode representation of object."""
        return self.name
예제 #3
0
class Lead(SalesforceModel):
    """
    Default Salesforce Lead model.
    """
    SOURCES = [
        'Advertisement', 'Employee Referral', 'External Referral',
        'Partner', 'Public Relations',
        'Seminar - Internal', 'Seminar - Partner', 'Trade Show', 'Web',
        'Word of mouth', 'Other',
    ]

    STATUSES = [
        'Contacted', 'Open', 'Qualified', 'Unqualified',
    ]

    RATINGS = [
        'Hot', 'Warm', 'Cold',
    ]

    LastName = models.CharField(max_length=80)
    FirstName = models.CharField(max_length=40, blank=True, null=True)
    Salutation = models.CharField(max_length=100, choices=[(x, x) for x in SALUTATIONS])
    Salutation = models.CharField(max_length=100,
                                  choices=[(x, x) for x in SALUTATIONS])
    Name = models.CharField(max_length=121, sf_read_only=models.READ_ONLY)
    Title = models.CharField(max_length=128)
    Company = models.CharField(max_length=255)
    Street = models.CharField(max_length=255)
    City = models.CharField(max_length=40)
    State = models.CharField(max_length=20)
    PostalCode = models.CharField(max_length=20)
    Country = models.CharField(max_length=40)
    Phone = models.CharField(max_length=255)
    Email = models.CharField(max_length=100)
    LeadSource = models.CharField(max_length=100,
                                  choices=[(x, x) for x in SOURCES])
    Status = models.CharField(max_length=100, choices=[(x, x) for x in STATUSES])
    Industry = models.CharField(max_length=100,
                                choices=[(x, x) for x in INDUSTRIES])
    # Added an example of special DateTime field in Salesforce that can
    # not be inserted, but can be updated
    # TODO write test for it
    EmailBouncedDate = models.DateTimeField(blank=True, null=True,
                                            sf_read_only=models.NOT_CREATEABLE)
    # Deleted object can be found only in querysets with "query_all" SF method.
    IsDeleted = models.BooleanField(default=False, sf_read_only=models.READ_ONLY)
    owner = models.ForeignKey(User, on_delete=models.DO_NOTHING,
                              default=models.DEFAULTED_ON_CREATE,
                              related_name='lead_owner_set')
    last_modified_by = models.ForeignKey(User, on_delete=models.DO_NOTHING, null=True,
                                         sf_read_only=models.READ_ONLY,
                                         related_name='lead_lastmodifiedby_set')
    is_converted = models.BooleanField(verbose_name='Converted',
                                       sf_read_only=models.NOT_UPDATEABLE,
                                       default=models.DEFAULTED_ON_CREATE)

    def __str__(self):
        return self.Name
예제 #4
0
class OpportunityContactRole(SalesforceModel):
    opportunity = models.ForeignKey(Opportunity,
                                    on_delete=models.DO_NOTHING,
                                    related_name='contact_roles')
    contact = models.ForeignKey(Contact,
                                on_delete=models.DO_NOTHING,
                                related_name='opportunity_roles')
    role = models.CharField(max_length=40, blank=True,
                            null=True)  # e.g. "Business User"
예제 #5
0
class Account(models.Model):
    is_deleted = models.BooleanField(verbose_name="Deleted",
                                     sf_read_only=models.READ_ONLY,
                                     default=False)
    master_record = models.ForeignKey(
        "self",
        models.DO_NOTHING,
        related_name="account_masterrecord_set",
        sf_read_only=models.READ_ONLY,
        blank=True,
        null=True,
    )
    name = models.CharField(max_length=255, verbose_name="Account Name")
    type = models.CharField(
        max_length=40,
        verbose_name="Account Type",
        choices=ACCOUNT_TYPE_CHOICES,
        blank=True,
        null=True,
    )
    parent = models.ForeignKey(
        "self",
        models.DO_NOTHING,
        related_name="account_parent_set",
        blank=True,
        null=True,
    )
    billing_street = models.TextField(blank=True, null=True)
    billing_city = models.CharField(max_length=40, blank=True, null=True)
    billing_state = models.CharField(max_length=80,
                                     verbose_name="Billing State/Province",
                                     blank=True,
                                     null=True)
    billing_postal_code = models.CharField(
        max_length=20,
        verbose_name="Billing Zip/Postal Code",
        blank=True,
        null=True)
    billing_country = models.CharField(max_length=80, blank=True, null=True)
    npe01_systemis_individual = models.BooleanField(
        db_column="npe01__SYSTEMIsIndividual__c",
        custom=True,
        verbose_name="_SYSTEM: IsIndividual",
        default=models.DEFAULTED_ON_CREATE,
        help_text=
        "Indicates whether or not this Account is special for Contacts (Household, One-to-One, Individual) vs a normal Account.",
    )

    class Meta(models.Model.Meta):
        db_table = "Account"
        verbose_name = "Account"
        verbose_name_plural = "Accounts"
        # keyPrefix = '001'

    def __str__(self):
        return "%s" % self.name
예제 #6
0
class Task(models.Model):
    who = models.ForeignKey(Lead,
                            on_delete=models.DO_NOTHING,
                            blank=True,
                            null=True)  # Reference to tables [Contact, Lead]
    what = models.ForeignKey(Account,
                             related_name='task_what_set',
                             on_delete=models.DO_NOTHING,
                             blank=True,
                             null=True)  # Refer
예제 #7
0
class OpportunityLineItem(SalesforceModel):
    opportunity = models.ForeignKey(Opportunity, on_delete=models.DO_NOTHING)
    pricebook_entry = models.ForeignKey('PricebookEntry', models.DO_NOTHING, verbose_name='Price Book Entry ID',
                                        sf_read_only=models.NOT_UPDATEABLE)
    product2 = models.ForeignKey('Product', models.DO_NOTHING, verbose_name='Product ID',
                                 sf_read_only=models.NOT_UPDATEABLE)
    name = models.CharField(max_length=376, verbose_name='Opportunity Product Name', sf_read_only=models.READ_ONLY)
    quantity = models.DecimalField(max_digits=12, decimal_places=2)
    total_price = models.DecimalField(max_digits=18, decimal_places=2, default=models.DEFAULTED_ON_CREATE)
    unit_price = models.DecimalField(max_digits=18, decimal_places=2, verbose_name='Sales Price',
                                     default=models.DEFAULTED_ON_CREATE)
예제 #8
0
class PricebookEntry(SalesforceModel):
	Name = models.CharField(max_length=255, db_column='Name', sf_read_only=models.READ_ONLY)
	Pricebook2 = models.ForeignKey('Pricebook', on_delete=models.DO_NOTHING)
	Product2 = models.ForeignKey('Product', on_delete=models.DO_NOTHING)
	UseStandardPrice = models.BooleanField(default=False)
	UnitPrice = models.DecimalField(decimal_places=2, max_digits=18)

	class Meta(SalesforceModel.Meta):
		db_table = 'PricebookEntry'
		verbose_name_plural = "PricebookEntries"

	def __str__(self):
		return self.Name
예제 #9
0
class CampaignMember(models.Model):
    """Model that maps to Salesforce CampaignMember object."""

    campaign = models.ForeignKey(Campaign, models.DO_NOTHING)
    lead = models.ForeignKey('Lead', models.DO_NOTHING)

    class Meta(models.Model.Meta):
        db_table = 'CampaignMember'
        verbose_name = 'Campaign Member'
        verbose_name_plural = 'Campaign Members'

    def __unicode__(self):
        """Return unicode representation of object."""
        return '{}:{}'.format(self.campaign, self.lead)
예제 #10
0
class Test(SalesforceParentModel):
    """
    Simple custom model with one custom and more standard fields.

    Salesforce object for this model can be created:
    A) automatically from the branch hynekcer/tooling-api-and-metadata
       by commands:
        $ python manage.py shell
            >> from salesforce.backend import tooling
            >> tooling.install_metadata_service()
            >> tooling.create_demo_test_object()
    or
    B) manually can create the same object with `API Name`: `django_Test__c`
        `Data Type` of the Record Name: `Text`

       Create three fields:
       Type            | API Name | Label
       ----------------+----------+----------
       Text            | TestText | Test Text
       Checkbox        | TestBool | Test Bool
       Lookup(Contact) | Contact  | Contact

       Set it accessible by you. (`Set Field-Leved Security`)
    """
    # This is a custom field because it is defined in the custom model.
    # The API name is therefore 'TestField__c'
    test_text = models.CharField(max_length=40)
    test_bool = models.BooleanField(default=False)
    contact = models.ForeignKey(Contact,
                                null=True,
                                on_delete=models.DO_NOTHING)

    class Meta:
        custom = True
        db_table = 'django_Test__c'
예제 #11
0
class Contact(models_extend.SalesforceModel):
    last_name = models.CharField(max_length=80)
    first_name = models.CharField(max_length=40, blank=True)
    account = models.ForeignKey(Account, on_delete=models.DO_NOTHING)

    class Meta:
        db_table = 'Contact'
예제 #12
0
class Lead(SalesforceModel):
    Company = models.CharField(max_length=255)
    LastName = models.CharField(max_length=80)
    Owner = models.ForeignKey(User,
                              on_delete=models.DO_NOTHING,
                              default=lambda: User(Id='DEFAULT'),
                              db_column='OwnerId')
예제 #13
0
class Attachment(models.Model):
    # A standard SFDC object that can have a relationship to any custom object
    name = models.CharField(max_length=80)
    parent = models.ForeignKey(Test,
                               sf_read_only=models.NOT_UPDATEABLE,
                               on_delete=models.DO_NOTHING)
    # The "body" of Attachment can't be queried for more rows togehter.
    body = models.TextField()
예제 #14
0
class ReviseOrder(models.Model):
    Product2Id = models.ForeignKey('Product', db_column='Product2Id__c', on_delete=models.DO_NOTHING)    
    user_id = models.IntegerField(db_column='user_id__c')
    status = models.CharField(db_column='status__c',choices=[(x, x) for x in order_status])

    class Meta:
        db_table = 'ReviseOrder__c'
        verbose_name = 'ReviseOrder'
        verbose_name_plural = 'ReviseOrders' 
예제 #15
0
class Attachment(models.Model):
    ''' Creamos el modelo de Attachment de acuerdo como esta en Salesforce '''
    # A standard SFDC object that can have a relationship to any custom object
    name = models.CharField(max_length=255)
    parent = models.ForeignKey(Provision,
                               sf_read_only=models.NOT_UPDATEABLE,
                               on_delete=models.DO_NOTHING)
    # The "body" of Attachment can't be queried for more rows togehter.
    body = models.TextField()
예제 #16
0
class Contact(SalesforceModel):
    last_name = models.CharField(max_length=80)
    owner = models.ForeignKey(User,
                              on_delete=models.DO_NOTHING,
                              default=models.DefaultedOnCreate(User))

    class Meta:
        managed = True
        db_table = 'Contact'
예제 #17
0
class DefaultMixin(SalesforceModel):
    """Common fields used in the most of SFDC models."""
    last_modified_date = models.DateTimeField(sf_read_only=models.READ_ONLY,
                                              auto_now=True)
    owner = models.ForeignKey(
        User, on_delete=models.DO_NOTHING,
        default=models.DEFAULTED_ON_CREATE)  # db_column='OwnerId'

    class Meta:
        abstract = True
예제 #18
0
class OpportunityLineItem(models.Model):
    """Model that maps to Salesforce OpportunityLineItem object."""

    opportunity = models.ForeignKey(Opportunity, models.DO_NOTHING)
    pricebook_entry = models.ForeignKey('PricebookEntry',
                                        models.DO_NOTHING,
                                        sf_read_only=models.NOT_UPDATEABLE)
    quantity = models.DecimalField(max_digits=12, decimal_places=2)
    discount = models.DecimalField(max_digits=5,
                                   decimal_places=2,
                                   blank=True,
                                   null=True)
    total_price = models.DecimalField(max_digits=18,
                                      decimal_places=2,
                                      default=models.DEFAULTED_ON_CREATE,
                                      blank=True,
                                      null=True)
    unit_price = models.DecimalField(max_digits=18,
                                     decimal_places=2,
                                     verbose_name='Sales Price',
                                     default=models.DEFAULTED_ON_CREATE,
                                     blank=True,
                                     null=True)
    list_price = models.DecimalField(max_digits=18,
                                     decimal_places=2,
                                     sf_read_only=models.READ_ONLY,
                                     blank=True,
                                     null=True)
    discount_code = models.ForeignKey(DiscountCode,
                                      models.DO_NOTHING,
                                      db_column='Discount_Code__c',
                                      custom=True,
                                      blank=True,
                                      null=True)

    class Meta(models.Model.Meta):
        db_table = 'OpportunityLineItem'
        verbose_name = 'Opportunity Product'
        verbose_name_plural = 'Opportunity Product'

    def __unicode__(self):
        """Return unicode representation of object."""
        return '{}:{}'.format(self.opportunity, self.pricebook_entry)
예제 #19
0
class OpportunityContactRole(models.Model):
    """Model that maps to Salesforce OpportunityContactRole object."""

    opportunity = models.ForeignKey(Opportunity,
                                    models.DO_NOTHING,
                                    sf_read_only=models.NOT_UPDATEABLE)
    contact = models.ForeignKey(Contact, models.DO_NOTHING)
    role = models.CharField(max_length=40, blank=True, null=True)
    is_primary = models.BooleanField(verbose_name='Primary',
                                     default=models.DEFAULTED_ON_CREATE)

    class Meta(models.Model.Meta):
        db_table = 'OpportunityContactRole'
        verbose_name = 'Opportunity Contact Role'
        verbose_name_plural = 'Opportunity Contact Role'

    def __unicode__(self):
        """Return unicode representation of object."""
        return '{}:{}'.format(self.opportunity, self.contact)
예제 #20
0
class Contact(SalesforceModel):
	# Example that db_column is not necessary for most of fields even with
	# lower case names and for ForeignKey
	account = models.ForeignKey(Account, on_delete=models.DO_NOTHING,
			blank=True, null=True)  # db_column: 'AccountId'
	last_name = models.CharField(max_length=80)
	first_name = models.CharField(max_length=40, blank=True)
	name = models.CharField(max_length=121, sf_read_only=models.READ_ONLY,
			verbose_name='Full Name')
	email = models.EmailField(blank=True, null=True)
	email_bounced_date = models.DateTimeField(blank=True, null=True)
	# The `default=` with lambda function is easy readable, but can be
	# problematic with migrations in the future because it is not serializable.
	# It can be replaced by normal function.
	owner = models.ForeignKey(User, on_delete=models.DO_NOTHING,
			default=models.DEFAULTED_ON_CREATE,
			related_name='contact_owner_set')

	def __str__(self):
		return self.name
예제 #21
0
class Contact(SalesforceModel):
    Account = models.ForeignKey(Account,
                                on_delete=models.DO_NOTHING,
                                db_column='AccountId',
                                blank=True,
                                null=True)
    LastName = models.CharField(max_length=80)
    FirstName = models.CharField(max_length=40, blank=True)
    Name = models.CharField(max_length=121,
                            sf_read_only=models.READ_ONLY,
                            verbose_name='Full Name')
    Email = models.EmailField(blank=True, null=True)
    EmailBouncedDate = models.DateTimeField(blank=True, null=True)
    Owner = models.ForeignKey(User,
                              on_delete=models.DO_NOTHING,
                              default=lambda: User(Id='DEFAULT'),
                              db_column='OwnerId',
                              related_name='contact_owner_set')

    def __unicode__(self):
        return self.Name
예제 #22
0
class Organization(models.Model):
    name = models.CharField(max_length=80, sf_read_only=models.NOT_CREATEABLE)
    division = models.CharField(max_length=80, sf_read_only=models.NOT_CREATEABLE, blank=True)
    street = models.TextField(sf_read_only=models.NOT_CREATEABLE, blank=True)
    city = models.CharField(max_length=40, sf_read_only=models.NOT_CREATEABLE, blank=True)
    country = models.CharField(max_length=80, sf_read_only=models.READ_ONLY, blank=True)
    address = models.TextField(sf_read_only=models.READ_ONLY, blank=True)  # This field type is a guess.
    phone = models.CharField(max_length=40, sf_read_only=models.NOT_CREATEABLE, blank=True)
    instance_name = models.CharField(max_length=5, sf_read_only=models.READ_ONLY, blank=True)
    is_sandbox = models.BooleanField(sf_read_only=models.READ_ONLY)
    created_date = models.DateTimeField(sf_read_only=models.READ_ONLY)
    created_by = models.ForeignKey(User, related_name='organization_createdby_set',
                                   sf_read_only=models.READ_ONLY, on_delete=models.DO_NOTHING)
    last_modified_date = models.DateTimeField(sf_read_only=models.READ_ONLY)
    last_modified_by = models.ForeignKey('User', related_name='organization_lastmodifiedby_set',
                                         sf_read_only=models.READ_ONLY, on_delete=models.DO_NOTHING)

    class Meta(models.Model.Meta):
        db_table = 'Organization'
        verbose_name = 'Organization'
        verbose_name_plural = 'Organizations'
class EventShopMaster(SalesforceParentModel):

    HakkouKaisuu = models.CharField(max_length=80, db_column='HakkouKaisuu__c')
    CouponRiyouKaisuu = models.CharField(max_length=80, db_column='CouponRiyouKaisuu__c')
    Service = models.CharField(max_length=80, db_column='Service__c')
    SankaTenpo = models.CharField(max_length=80, db_column='SankaTenpo__c')
    Jissibi = models.CharField(max_length=80, db_column='Jissibi__c')
    Shuryoubi = models.CharField(max_length=80, db_column='Shuryoubi__c')
    HansokuEvent = models.ForeignKey(EventPromotion, db_column='HansokuEvent__c', on_delete=models.DO_NOTHING)

    class Meta:
        custom = True
        db_table = 'EventShopMaster__c'
예제 #24
0
class CustomVectorForContact(models.Model):
    is_deleted = models.BooleanField(verbose_name='Deleted',
                                     sf_read_only=models.READ_ONLY)
    name = models.CharField(max_length=80,
                            verbose_name='Custom Vector for contacts Name',
                            sf_read_only=models.READ_ONLY)
    contact = models.ForeignKey(
        Contact,
        models.DO_NOTHING,
        related_name="vectors_for_contact",
        custom=True,
        sf_read_only=models.NOT_UPDATEABLE)  # Master Detail Relationship 0
    vector = models.ForeignKey(CustomVector,
                               models.DO_NOTHING,
                               related_name="contacts_for_vector",
                               db_column='CustomVector__c',
                               custom=True)

    class Meta(models.Model.Meta):
        db_table = 'CustomVectorforcontacts__c'
        verbose_name = 'Custom Vector for contacts'
        verbose_name_plural = 'Custom Vectors for contacts'
예제 #25
0
class PricebookEntry(models.Model):
    """Model that maps to Salesforce PricebookEntry object."""

    pricebook2 = models.ForeignKey(Pricebook2,
                                   models.DO_NOTHING,
                                   sf_read_only=models.NOT_UPDATEABLE)
    product2 = models.ForeignKey('Product2',
                                 models.DO_NOTHING,
                                 sf_read_only=models.NOT_UPDATEABLE)
    unit_price = models.DecimalField(max_digits=18,
                                     decimal_places=2,
                                     verbose_name='List Price')
    is_active = models.BooleanField(verbose_name='Active',
                                    default=models.DEFAULTED_ON_CREATE)

    class Meta(models.Model.Meta):
        db_table = 'PricebookEntry'
        verbose_name = 'Price Book Entry'
        verbose_name_plural = 'Price Book Entries'

    def __unicode__(self):
        """Return unicode representation of object."""
        return '{}:{}'.format(self.pricebook2, self.product2)
예제 #26
0
class Provision(SalesforceParentModel):
    ''' Creamos el modelo de Provision de acuerdo como esta en Salesforce '''
    estatus = models.CharField(max_length=20)
    Ejecuci_n_Relacionada = models.ForeignKey(Ejecuci_n_Pago,
                                              on_delete=models.DO_NOTHING,
                                              blank=True,
                                              null=True)

    #fecha_de_factura = models.CharField('Fecha de Factura', max_length=15,db_column='Fecha_de_Factura__c')
    #caja_Chica_Relacionada = models.CharField('Caja Chica Relacionada',db_column='Caja_Chica_Relacionada__c',max_length=255)

    class Meta:
        custom = True
        db_table = 'Provision__c'
        ordering = ['-name']

    def __str__(self):
        return self.name
예제 #27
0
class AbstractAccount(SalesforceModel):
    """
	Default Salesforce Account model.
	"""
    TYPES = [
        'Analyst', 'Competitor', 'Customer', 'Integrator', 'Investor',
        'Partner', 'Press', 'Prospect', 'Reseller', 'Other'
    ]

    Owner = models.ForeignKey(User,
                              on_delete=models.DO_NOTHING,
                              default=lambda: User(pk='DEFAULT'),
                              db_column='OwnerId')
    Type = models.CharField(max_length=100,
                            choices=[(x, x) for x in TYPES],
                            null=True)
    BillingStreet = models.CharField(max_length=255)
    BillingCity = models.CharField(max_length=40)
    BillingState = models.CharField(max_length=20)
    BillingPostalCode = models.CharField(max_length=20)
    BillingCountry = models.CharField(max_length=40)
    ShippingStreet = models.CharField(max_length=255)
    ShippingCity = models.CharField(max_length=40)
    ShippingState = models.CharField(max_length=20)
    ShippingPostalCode = models.CharField(max_length=20)
    ShippingCountry = models.CharField(max_length=40)
    Phone = models.CharField(max_length=255)
    Fax = models.CharField(max_length=255)
    Website = models.CharField(max_length=255)
    Industry = models.CharField(max_length=100,
                                choices=[(x, x) for x in INDUSTRIES])
    Description = models.TextField()
    # Added read only option, otherwise the object can not be never saved
    # If the model is used also with non SF databases then there should be set
    # allow_now=True or null=True
    LastModifiedDate = models.DateTimeField(db_column='LastModifiedDate',
                                            sf_read_only=models.READ_ONLY,
                                            auto_now=True)

    class Meta(SalesforceModel.Meta):
        abstract = True

    def __unicode__(self):
        return self.Name
예제 #28
0
class Individual(models.Model):
    owner = models.ForeignKey(
        "User", models.DO_NOTHING,
        related_name="individual_owner_set")  # Master Detail Relationship *
    is_deleted = models.BooleanField(verbose_name="Deleted",
                                     sf_read_only=models.READ_ONLY,
                                     default=False)
    last_name = models.CharField(max_length=80)
    first_name = models.CharField(max_length=40, blank=True, null=True)
    salutation = models.CharField(max_length=40,
                                  choices=SALUTATION_CHOICES,
                                  blank=True,
                                  null=True)
    middle_name = models.CharField(max_length=40, blank=True, null=True)
    suffix = models.CharField(max_length=40, blank=True, null=True)
    name = models.CharField(max_length=121, sf_read_only=models.READ_ONLY)

    class Meta(models.Model.Meta):
        db_table = "Individual"
        verbose_name = "Individual"
        verbose_name_plural = "Individuals"
예제 #29
0
class Lead(models.Model):
    """Model that maps to Salesforce Lead object."""

    last_name = models.CharField(max_length=80)
    first_name = models.CharField(max_length=40, blank=True, null=True)
    company = models.CharField(max_length=255, verbose_name='Organization')
    email = models.EmailField()
    status = models.CharField(max_length=40,
                              default=models.DEFAULTED_ON_CREATE)
    is_converted = models.BooleanField(verbose_name='Converted',
                                       sf_read_only=models.NOT_UPDATEABLE,
                                       default=models.DEFAULTED_ON_CREATE)
    converted_account = models.ForeignKey(Account,
                                          models.DO_NOTHING,
                                          sf_read_only=models.READ_ONLY,
                                          blank=True,
                                          null=True)
    converted_contact = models.ForeignKey(Contact,
                                          models.DO_NOTHING,
                                          sf_read_only=models.READ_ONLY,
                                          blank=True,
                                          null=True)
    username = models.CharField(custom=True, max_length=100)
    year_of_birth = models.CharField(custom=True,
                                     db_column='Year_of_Birth__c',
                                     max_length=255,
                                     verbose_name='Year of Birth',
                                     blank=True,
                                     null=True)
    language = models.CharField(custom=True,
                                max_length=255,
                                blank=True,
                                null=True)
    country = models.CharField(db_column='Country__c',
                               custom=True,
                               max_length=255,
                               choices=COUNTRIES,
                               blank=True,
                               null=True)
    pi_utm_campaign = models.CharField(
        db_column='pi__utm_campaign__c',
        custom=True,
        max_length=255,
        verbose_name='Google Analytics Campaign',
        blank=True,
        null=True)
    pi_utm_content = models.CharField(db_column='pi__utm_content__c',
                                      custom=True,
                                      max_length=255,
                                      verbose_name='Google Analytics Content',
                                      blank=True,
                                      null=True)
    pi_utm_medium = models.CharField(db_column='pi__utm_medium__c',
                                     custom=True,
                                     max_length=255,
                                     verbose_name='Google Analytics Medium',
                                     blank=True,
                                     null=True)
    pi_utm_source = models.CharField(db_column='pi__utm_source__c',
                                     custom=True,
                                     max_length=255,
                                     verbose_name='Google Analytics Source',
                                     blank=True,
                                     null=True)
    pi_utm_term = models.CharField(db_column='pi__utm_term__c',
                                   custom=True,
                                   max_length=255,
                                   verbose_name='Google Analytics Term',
                                   blank=True,
                                   null=True)
    programs = models.CharField(custom=True,
                                max_length=4099,
                                default='OpenClassroom')
    registration_date = models.DateTimeField(custom=True,
                                             db_column='Registration_Date__c',
                                             verbose_name='Registration Date',
                                             blank=True,
                                             null=True)
    level_of_education = models.CharField(custom=True,
                                          db_column='Level_of_Education__c',
                                          max_length=255,
                                          verbose_name='Level of Education',
                                          blank=True,
                                          null=True)
    interest = models.TextField(custom=True, blank=True)
    gender = models.CharField(custom=True,
                              max_length=255,
                              blank=True,
                              null=True)

    class Meta(models.Model.Meta):
        db_table = 'Lead'
        verbose_name = 'Lead'
        verbose_name_plural = 'Leads'

    def __unicode__(self):
        """Return unicode representation of object."""
        return self.username
예제 #30
0
class Contact(models.Model):
    """Model that maps to Salesforce Contact object."""

    account = models.ForeignKey(Account,
                                models.DO_NOTHING,
                                blank=True,
                                null=True)
    last_name = models.CharField(max_length=80)
    first_name = models.CharField(max_length=40, blank=True, null=True)
    name = models.CharField(max_length=121,
                            verbose_name='Full Name',
                            sf_read_only=models.READ_ONLY)
    email = models.EmailField()
    year_of_birth = models.CharField(custom=True,
                                     db_column='Year_of_Birth__c',
                                     max_length=255,
                                     verbose_name='Year of Birth',
                                     blank=True,
                                     null=True)
    language = models.CharField(custom=True,
                                max_length=255,
                                blank=True,
                                null=True)
    country = models.CharField(custom=True,
                               max_length=255,
                               choices=COUNTRIES,
                               blank=True,
                               null=True)
    pi_utm_campaign = models.CharField(
        db_column='pi__utm_campaign__c',
        custom=True,
        max_length=255,
        verbose_name='Google Analytics Campaign',
        blank=True,
        null=True)
    pi_utm_content = models.CharField(db_column='pi__utm_content__c',
                                      custom=True,
                                      max_length=255,
                                      verbose_name='Google Analytics Content',
                                      blank=True,
                                      null=True)
    pi_utm_medium = models.CharField(db_column='pi__utm_medium__c',
                                     custom=True,
                                     max_length=255,
                                     verbose_name='Google Analytics Medium',
                                     blank=True,
                                     null=True)
    pi_utm_source = models.CharField(db_column='pi__utm_source__c',
                                     custom=True,
                                     max_length=255,
                                     verbose_name='Google Analytics Source',
                                     blank=True,
                                     null=True)
    pi_utm_term = models.CharField(db_column='pi__utm_term__c',
                                   custom=True,
                                   max_length=255,
                                   verbose_name='Google Analytics Term',
                                   blank=True,
                                   null=True)
    registration_date = models.DateTimeField(custom=True,
                                             db_column='Registration_Date__c',
                                             verbose_name='Registration Date',
                                             blank=True,
                                             null=True)
    level_of_education = models.CharField(custom=True,
                                          db_column='Level_of_Education__c',
                                          max_length=255,
                                          verbose_name='Level of Education',
                                          blank=True,
                                          null=True)
    interest = models.TextField(custom=True, blank=True)
    gender = models.CharField(custom=True,
                              max_length=255,
                              blank=True,
                              null=True)

    class Meta(models.Model.Meta):
        db_table = 'Contact'
        verbose_name = 'Contact'
        verbose_name_plural = 'Contacts'

    def __unicode__(self):
        """Return unicode representation of object."""
        return self.name