diff options
Diffstat (limited to 'app/syndication')
-rw-r--r-- | app/syndication/models.py | 9 | ||||
-rw-r--r-- | app/syndication/syndicators.py | 3 |
2 files changed, 7 insertions, 5 deletions
diff --git a/app/syndication/models.py b/app/syndication/models.py index 53a6ed1..7ddb941 100644 --- a/app/syndication/models.py +++ b/app/syndication/models.py @@ -24,7 +24,7 @@ class SyndicatedItem(models.Model): ('1', "Unsent"), ('2', "Sent"), ) - status = models.CharField(max_length=1, choices=STATUS, null=True, blank=True) + status = models.CharField(max_length=1, choices=STATUS, null=True) rel_link = models.CharField(max_length=300, null=True, blank=True) def __str__(self): @@ -34,16 +34,17 @@ class SyndicatedItem(models.Model): return ','.join(str(synd) for synd in self.syndicate.all()) - @receiver(post_save, sender=SyndicatedItem) def post_save_events(sender, update_fields, created, instance, **kwargs): - if instance.status == 1: + print(instance.status) + if instance.status == "1": + print("---------calling-----------") for item in instance.syndicate.all(): if item.name == "Medium": instance.rel_link = post_to_medium(instance.content_object) instance.status = 2 if item.name == "Facebook": - build_facebook_feed(instance) + build_facebook_feed() instance.status = 2 post_save.disconnect(post_save_events, sender=SyndicatedItem) instance.save() diff --git a/app/syndication/syndicators.py b/app/syndication/syndicators.py index 82b9564..e48ff4d 100644 --- a/app/syndication/syndicators.py +++ b/app/syndication/syndicators.py @@ -32,7 +32,8 @@ def post_to_medium(item): return post["url"] -def build_facebook_feed(item): +def build_facebook_feed(): + print("+++++++++++++building+++++++++++") c = Client() response = c.get('/iafeed.xml', HTTP_HOST='127.0.0.1') f = open("%siafeed.xml" % settings.FLATFILES_ROOT, 'wb') |