コード例 #1
0
ファイル: models.py プロジェクト: joausaga/social-ideation
class SocialNetworkApp(models.Model):
    name = models.CharField(max_length=50)
    url = models.URLField(null=True, blank=True)
    connector = models.ForeignKey(connectors.models.SocialNetworkConnector)
    blocked = models.DateTimeField(null=True, editable=False, default=None)
    app_id = models.CharField(max_length=50)
    app_secret = models.CharField(max_length=50, null=True, blank=True)
    redirect_uri = models.URLField(null=True, blank=True)
    community = models.ForeignKey(SocialNetworkAppCommunity,
                                  null=True,
                                  blank=True)
    app_access_token = models.CharField(max_length=300, null=True, blank=True)
    callback_real_time_updates = models.URLField(null=True, blank=True)
    object_real_time_updates = models.CharField(max_length=100,
                                                null=True,
                                                blank=True,
                                                default='page')
    field_real_time_updates = models.CharField(max_length=50,
                                               null=True,
                                               blank=True,
                                               default='feed')
    token_real_time_updates = models.CharField(max_length=100,
                                               null=True,
                                               editable=False)
    subscribed_read_time_updates = models.BooleanField(default=False,
                                                       editable=False)
    last_real_time_update_sig = models.CharField(max_length=100,
                                                 null=True,
                                                 editable=False)
    batch_requests = models.BooleanField(default=False)
    max_batch_requests = models.IntegerField(null=True, blank=True)

    def __unicode__(self):
        return self.name
コード例 #2
0
ファイル: models.py プロジェクト: joausaga/social-ideation
class BaseContent(models.Model):
    # Id Fields (after the idea is synchronized in both platforms it will have two ids)
    sn_id = models.CharField(max_length=100, null=True)
    cp_id = models.CharField(max_length=100, null=True)
    # Common Properties
    datetime = models.DateTimeField(null=True)
    author = models.ForeignKey(Author)
    # Context
    initiative = models.ForeignKey(Initiative)
    campaign = models.ForeignKey(Campaign)
    # Original Source
    source = models.CharField(max_length=50,
                              choices=(
                                  ('consultation_platform',
                                   'Consultation Platform'),
                                  ('social_network', 'Social Network'),
                              ))
    source_consultation = models.ForeignKey(ConsultationPlatform, null=True)
    source_social = models.ForeignKey(SocialNetworkApp, null=True)
    # Property to save any other information
    payload = models.TextField(null=True, editable=False)
    # Flags
    is_new = models.BooleanField(default=True)
    has_changed = models.BooleanField(default=False)
    exist_cp = models.BooleanField(default=False)
    exist_sn = models.BooleanField(default=False)
    sync = models.BooleanField(default=False)
    # Extra datetime field used when the author deactivates its account.
    deactivation_time = models.DateTimeField(null=True)

    class Meta:
        abstract = True
コード例 #3
0
class SocialNetworkAppUser(models.Model):
    external_id = models.CharField(max_length=50)
    name = models.CharField(max_length=100, null=True)
    url = models.URLField(null=True, blank=True)
    email = models.EmailField()
    snapp = models.ForeignKey('SocialNetworkApp')
    access_token = models.CharField(max_length=300)
    access_token_exp = models.DateTimeField(editable=False)
    read_permissions = models.BooleanField(default=False, editable=False)
    write_permissions = models.BooleanField(default=False, editable=False)

    def __unicode__(self):
        if self.name:
            return self.name
        else:
            return self.external_id
コード例 #4
0
class Initiative(models.Model):
    external_id = models.IntegerField(editable=False)
    name = models.CharField(max_length=50, editable=False)
    platform = models.ForeignKey(ConsultationPlatform, editable=False)
    social_network = models.ManyToManyField(SocialNetworkApp, blank=True)
    hashtag = models.CharField(unique=True, max_length=14, null=True,
                               help_text="Max length 14 characters (do not include '#')")
    url = models.URLField(editable=False)
    users = models.IntegerField(editable=False, default=0)
    ideas = models.IntegerField(editable=False, default=0)
    votes = models.IntegerField(editable=False, default=0)
    comments = models.IntegerField(editable=False, default=0)
    active = models.BooleanField(default=False)
    language = models.CharField(max_length=5, default='en', choices=(('en', 'English'), ('es', 'Spanish'),
                                                                     ('it', 'Italian'),))
    notification_emails = models.BooleanField(default=False)

    def __unicode__(self):
        return self.name
コード例 #5
0
ファイル: models.py プロジェクト: joausaga/social-ideation
class Campaign(models.Model):
    external_id = models.IntegerField(editable=False)
    name = models.CharField(max_length=100)
    initiative = models.ForeignKey(Initiative)
    hashtag = models.CharField(max_length=20,
                               null=True,
                               help_text="Max length 20 characters "
                               "(do not include '#')")
    notified = models.BooleanField(default=False)

    def __unicode__(self):
        return self.name
コード例 #6
0
ファイル: models.py プロジェクト: joausaga/social-ideation
class AutoComment(models.Model):
    sn_id = models.CharField(max_length=100)
    author = models.ForeignKey(SocialNetworkAppUser)
    parent_idea = models.CharField(max_length=100)
    exist = models.BooleanField(default=True)