The error occurs in the controller function call. returns an array of data. I need to pass this array to the template.
views.py:
def new_authors(request):   
    new_authors = UserProfile.get_new_authors_entries()
    # UserProfile.get_new_authors_entries() retrun:
    #[
    #   {
    #       'id': 4, 
    #       'username': 'zzzzzz'
    #   }, 
    #   {
    #       'id': 5, 
    #       'username': 'wwwwww'
    #   }
    #]
    return HttpResponse(json.dumps(new_authors), content_type='application/json')   
But I get the following error message:
File "/usr/lib/python3.4/json/encoder.py", line 173, in default
    raise TypeError(repr(o) + " is not JSON serializable") TypeError: [{'id': 4,  'username': 'zzzzzz'}, {'id': 5, 'username': 'wwwwww'}] is not JSON serializable
models.py:
class UserProfile(User):            
    @classmethod
    def get_new_authors_entries(self, cut_begin=0, cut_end=2):
        return self.objects.filter(is_active=1, is_superuser=0).values('id', 'username')[cut_begin:cut_end] 
 
     
    