Exemple #1
0
    def obj_update(self, bundle, **kwargs):
        ''' Updates content when resource is PUT or PATCHed '''

        # These ensure that counts are present if ideas are created with extra content
        bundle = count_builder(bundle, 'tags', 'tag_count')

        return super(ProjectResource, self).obj_create(bundle)
Exemple #2
0
    def obj_update(self, bundle, **kwargs):
        """ Updates content when resource is PUT or PATCHed """

        # These ensure that counts are present if ideas are created with tags/likes/dislikes and comments
        bundle = count_builder(bundle, "tags", "tag_count")

        return super(IdeaResource, self).obj_create(bundle)
Exemple #3
0
    def obj_update(self, bundle, **kwargs):
        """ Updates content when resource is PUT or PATCHed """

        # These ensure that counts are present if ideas are created with tags/likes/dislikes and comments
        bundle = count_builder(bundle, 'tags', 'tag_count')

        return super(IdeaResource, self).obj_create(bundle)
Exemple #4
0
 def obj_update(self, bundle, **kwargs):
     ''' Updates content when resource is PUT or PATCHed '''
     
     # These ensure that counts are present if ideas are created with extra content
     bundle = count_builder(bundle, 'tags', 'tag_count')
              
     return super(ProjectResource, self).obj_create(bundle)
Exemple #5
0
 def obj_create(self, bundle, **kwargs):
     ''' Modifies the content before submission '''
     
     # Add in the user
     bundle.data['user'] = bundle.request.user.username
     
     # Sanitize tags before they get submitted
     try: bundle.data['tags'] = cleanup_tags(bundle.data['tags'])
     except: pass
     
     # These ensure that counts are present if projects are created with tags and backs and comments
     bundle = count_builder(bundle, 'comments',  'comment_count')
     bundle = count_builder(bundle, 'backs',     'back_count')
     bundle = count_builder(bundle, 'tags',      'tag_count')
      
     return super(ProjectResource, self).obj_create(bundle)
Exemple #6
0
 def obj_create(self, bundle, **kwargs):
     """ How to create a feedback object  """
     
     # Add the user to the data payload
     bundle.data['user'] = bundle.request.user.username
     bundle = count_builder(bundle, 'comments',  'comment_count')
     
     return super(FeedbackResource, self).obj_create(bundle)
Exemple #7
0
    def obj_create(self, bundle, **kwargs):
        ''' Modifies the content before submission '''

        # Add in the user
        bundle.data['user'] = bundle.request.user.username

        # Sanitize tags before they get submitted
        try:
            bundle.data['tags'] = cleanup_tags(bundle.data['tags'])
        except:
            pass

        # These ensure that counts are present if projects are created with tags and backs and comments
        bundle = count_builder(bundle, 'comments', 'comment_count')
        bundle = count_builder(bundle, 'backs', 'back_count')
        bundle = count_builder(bundle, 'tags', 'tag_count')

        return super(ProjectResource, self).obj_create(bundle)
Exemple #8
0
    def obj_create(self, bundle, **kwargs):
        """ Modifies the content before submission """

        # Add in the user
        bundle.data["user"] = bundle.request.user.username
        # These ensure that counts are present if ideas are created with tags/likes/dislikes and comments
        bundle = count_builder(bundle, "comments", "comment_count")
        bundle = count_builder(bundle, "likes", "like_count")
        bundle = count_builder(bundle, "dislikes", "dislike_count")
        bundle = count_builder(bundle, "tags", "tag_count")

        # Sanitize tags before they get submitted
        try:
            bundle.data["tags"] = cleanup_tags(bundle.data["tags"])
        except:
            pass

        # Finally build the score
        bundle.data["vote_score"] = vote_score(bundle.data["like_count"], bundle.data["dislike_count"])

        return super(IdeaResource, self).obj_create(bundle)
Exemple #9
0
    def obj_create(self, bundle, **kwargs):
        """ Modifies the content before submission """

        # Add in the user
        bundle.data['user'] = bundle.request.user.username
        # These ensure that counts are present if ideas are created with tags/likes/dislikes and comments
        bundle = count_builder(bundle, 'comments', 'comment_count')
        bundle = count_builder(bundle, 'likes', 'like_count')
        bundle = count_builder(bundle, 'dislikes', 'dislike_count')
        bundle = count_builder(bundle, 'tags', 'tag_count')

        # Sanitize tags before they get submitted
        try:
            bundle.data['tags'] = cleanup_tags(bundle.data['tags'])
        except:
            pass

        # Finally build the score
        bundle.data['vote_score'] = vote_score(bundle.data['like_count'],
                                               bundle.data['dislike_count'])

        return super(IdeaResource, self).obj_create(bundle)