Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

229
Views
Django why getting this error No user profile found matching the query

I am trying to implement load more button so I am writing this view for load json data but I am not understanding why I am getting this error. No user profile found matching the query Raised by: members.views.UserProfileUpdate

here is my view:

class PostJsonListView(View):
    def get(self, *args, **kwargs):
        print(kwargs)
        upper = kwargs.get('num_posts')
        lower = upper - 3 
        posts = list(Blog.objects.values()[lower:upper])
        posts_size = len(Blog.objects.all())
        max_size = True if upper >= posts_size else False
        return JsonResponse({'data': posts, 'max': max_size}, safe=False)

this is my blog app urls.py

path('posts-json/<int:num_posts>',PostJsonListView.as_view(),name='json-view')

this is my members app urls.py

path('<slug:slug>/', UserProfileUpdate.as_view(), name='update-profile'),

if I put any wrong url like this http://127.0.0.1:8000/sassassdsadasdd/ giving me the same error No user profile found matching the query Raised by: members.views.UserProfileUpdate

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you are in the UserProfileUpdate view, using the slug for getting the profile object like this:

Profile.objects.get(username=slug)

but! you should use the get_object_or_404 shortcut functions.

from django.shortcuts import get_object_or_404
get_object_or_404(Profile, username=slug)

refrence

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!