Ejemplo n.º 1
0
    def get_category_info(category):
        result = Objects.get_object_info(category)
        owners = list()
        for owner in category.owners.all():
            user_extension = Users.get_user_extension(owner.username)
            if user_extension:
                owners.append(Users.get_user_info(user_extension))

        result["owners"] = owners
        return result
Ejemplo n.º 2
0
 def get_post_win_count_by_user(user_id):
     try:
         user = Users.get_user_by_id(user_id)
         user_extension = Users.get_user_extension(user.username)
         count = 0
         for fp in ForumPost.objects.all():
             if user_extension in fp.win_users.all():
                 count += 1
         return count
     except Exception as ex:
         Logs.print_current_function_name_and_line_number(ex)
         return 0