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 1003583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:00:10+00:00 2026-05-16T08:00:10+00:00

I seem to be stuck and am not sure which is the best direction

  • 0

I seem to be stuck and am not sure which is the best direction to take.

I have a few apps in my project and would like to combine three views into one template.

I have a userprofile in which I would like to display his info, latest news feeds and also his photos

Through this I am making use of jQuery tabs

I have defined my three tabs out of which one calls on a regular div and the other two are urls that get called in.

<a href="wall/recent">wall</a> and <a href="photos/recent">photos</a>

the address bar reads the following when on a users profile
http://localhost:8000/profiles/profile_name/

in my views.py for wall and photos looks like the following

@login_required
def index(request, template_name='wall/_index.html'):
    photos = Photos.objects.filter(user=request.user).order_by('-id')
    context = { 'photos': photos, }

    return render_to_response(template_name, context,
        context_instance=RequestContext(request))

But if I then look at MY profile it is fine, but whenever I switch to another users profile it sill seems to display some of my information.

I know that request.user is looking at the logged in user, how do I obtain that user in the address bar and pass it on so it displays the correct info ie if profile_name = john then displays johns photos, recent wall items etc.

  • 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-05-16T08:00:10+00:00Added an answer on May 16, 2026 at 8:00 am

    If you’ve got a urls.py like this:

    urlpatterns = patterns('',
                          (r'^profiles/(?P<prof_name>[A-Za-z0-9\-_]+)/$', 'appname.views.index'))
    

    Then your view code can be modified like this:

    @login_required
    def index(request, prof_name, template_name='wall/_index.html'):
        photos = Photos.objects.filter(user__username=prof_name).order_by('-id')
        context = { 'photos': photos, }
    
        return render_to_response(template_name, context,
            context_instance=RequestContext(request))
    

    What this does is bind the name prof_name to whatever value is in the bit of the URL after profiles/ and before the final /. Given the URL /profiles/john/, you’d end up with the index view being called, with prof_name set to john.

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

Sidebar

Related Questions

I seem to have stuck numerous hours in a modal dialog with unexpected behavior
I'm stuck deciding which to use as both seem to work. Should I be
I have been stuck on this for a while now and I cannot seem
I'm working on learning Objective-C/Coaoa, but I've seem to have gotten a bit stuck
Well, not sure whats going on. I have been trying to follow by examples
I'm not sure which is the better way of how to design forms. labels
I'm working on a generative art project where I would like to allow users
I have a web application running in Pocket IE (not sure of the exact
I seem to be stuck in Kafka-land, with a java.lang.String that I can't seem
So I'm messing around with asp.net and I seem to be stuck on a

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.