Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8294051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:03:57+00:00 2026-06-08T14:03:57+00:00

Right I am having a hard time understanding this one, On my local environment

  • 0

Right I am having a hard time understanding this one,

On my local environment I have integrated username lookup for the django User object:

class UserResource(ModelResource):
    class Meta:
        queryset = User.objects.all()
        excludes = ['password', 'email', 'is_staff', 'is_active', 'is_superuser']
        resource_name = 'users'
        include_resource_uri = False
        filtering = {
            'username': ALL
        }

    def prepend_urls(self):
        return [
            url(r"^(?P<resource_name>%s)/(?P<username>[\w\d_.-]+)/$" % self._meta.resource_name, self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
        ]

In tastypie’s source, resources.py I have added two print statements at line 1800+

def obj_get(self, request=None, **kwargs):
    """
    A ORM-specific implementation of ``obj_get``.

    Takes optional ``kwargs``, which are used to narrow the query to find
    the instance.
    """
    try:
        print "1, ", kwargs
        base_object_list = self.get_object_list(request).filter(**kwargs)
        print "2, ", base_object_list
        # etcetera

Visiting:

/api/v1/users/foo/?format=json

this prints:

1,  {'username': foo'}
2,  [<User: foo>]
1,  {'id': 1}
2,  [<User: foo>]

And returns the correct JSON object.

However, on my remote (dev) server I have the exact same setup (I double checked all files), the only difference seems to be it’s running the tastypie python 2.7 egg instead of 2.6, anyway I get this print:

1,  {'pk': u'foo'}
[27/Jul/2012 10:48:37] "GET /api/v1/users/foo/?format=json HTTP/1.0" 404 1219

I also get this stacktrace:

{
error_message: "Invalid resource lookup data provided (mismatched type).",
traceback: "Traceback (most recent call last):

  File "...path.../resources.py", line 192, in wrapper
    response = callback(request, *args, **kwargs)

  File "...path.../resources.py", line 406, in dispatch_detail
    return self.dispatch('detail', request, **kwargs)

  File "...path.../resources.py", line 427, in dispatch
    response = method(request, **kwargs)

  File "...path.../resources.py", line 1051, in get_detail
    obj = self.cached_obj_get(request=request, **self.remove_api_resource_names(kwargs))

  File "...path.../resources.py", line 921, in cached_obj_get
    bundle = self.obj_get(request=request, **kwargs)

  File "/...path.../resources.py", line 1765, in obj_get
    raise NotFound("Invalid resource lookup data provided (mismatched type).")

NotFound: Invalid resource lookup data provided (mismatched type).
"

}

Any thoughts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T14:03:59+00:00Added an answer on June 8, 2026 at 2:03 pm

    Right, the answer:

    changing prepend_urls to (to be deprecated) override_urls fixes the bug, I will report this one at github, seems to be a 2.7 egg issue

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been having a hard time coming up a solution with this one. I'm
I'm having hard time getting this snippet to work. I have made a minimal
I'm having hard time to get the right solution for this, so I need
I am having a hard time getting the quotes right in this code. Don't
I am having a hard time understanding this and hopefully someone can correct me
I know this is simple but am having a hard time finding the right
right guys im having trouble with one. what i want to do is have
I'm having a hard time how to align the Word Code ein in this
This should be simple, very simple, but I'm having a hard time with it.
I'm looking hard at WF 4.0 right now, but I'm having a hard time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.