Issues (27)

th_twitter/models.py (1 issue)

1
# coding: utf-8
2
from django.db import models
3
from django_th.models.services import Services
4
from django_th.models import TriggerService
5
6
"""
7
    https://dev.twitter.com/rest/public/timelines
8
    https://dev.twitter.com/rest/reference/get/statuses/user_timeline
9
    https://dev.twitter.com/rest/reference/get/search/tweets
10
11
    Twitter model
12
    this permits to search tag or screen
13
    and store the last reached tweet_id with since_id, max_id, count
14
"""
15
16
17 View Code Duplication
class Twitter(Services):
0 ignored issues
show
This code seems to be duplicated in your project.
Loading history...
18
    """
19
20
        Twitter model to store what the kind
21
        of data you want to handle
22
23
    """
24
    tag = models.CharField(max_length=80, null=True, blank=True)
25
    screen = models.CharField(max_length=80, null=True, blank=True)
26
    fav = models.BooleanField(default=False)
27
    since_id = models.BigIntegerField(null=True, blank=True)
28
    max_id = models.BigIntegerField(null=True, blank=True)
29
    count = models.IntegerField(null=True, blank=True)
30
    trigger = models.ForeignKey(TriggerService)
31
32
    class Meta:
33
        app_label = 'th_twitter'
34
        db_table = 'django_th_twitter'
35
36
    def show(self):
37
        """
38
39
        :return: string representing object
40
        """
41
        return "My Twitter %s %s %s" % (self.screen, self.tag, self.fav)
42
43
    def __str__(self):
44
        return "%s" % self.screen
45