Ejemplo n.º 1
0
    def get_feed_initial(self, instance):
        feed_item = FeedBusiness.feed_get_or_create(instance)

        initial = {
            'tags': feed_item.tags.all(),
        }

        return initial
Ejemplo n.º 2
0
    def __load_other_fields(self, instance, kwargs):
        feed_item = FeedBusiness.feed_get_or_create(instance)

        initial = {
            'communities': feed_item.communities.all(),
            'taxonomies': feed_item.taxonomies.all()
        }

        kwargs['initial'].update(initial)
Ejemplo n.º 3
0
def save_feed_item(article, data=None):
    feed_object = BusinessFeed.feed_get_or_create(article)
    feed_object.date = article.publishin if article.is_published() else None

    # for(key, value) in data.items():
    #     print "here", data.items(), key, feed_object, feed_object.key
    #     if hasattr(feed_object, key):
    #         setattr(feed_object, key, value)

    feed_object.save()

    return feed_object
Ejemplo n.º 4
0
Archivo: feed.py Proyecto: tainaml/p_gs
def save_feed_question(question, data=None):
    feed_object = BusinessFeed.feed_get_or_create(question)
    feed_object.save()
    return feed_object
Ejemplo n.º 5
0
 def get_feed_initial(self, instance):
     initial = super(CoreArticleContributorForm,
                     self).get_feed_initial(instance)
     feed_item = FeedBusiness.feed_get_or_create(instance)
     initial.update({'official': feed_item.official})
     return initial