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

  • Home
  • SEARCH
  • 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 4339136
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:10:34+00:00 2026-05-21T11:10:34+00:00

I am building a website just for fun of learning programming more fully, but

  • 0

I am building a website just for fun of learning programming more fully, but have run into an issue. I am trying to make a status update area of the user homepage where the latest status update for the current user will display up top of their page(like Facebook). However the function I have made to retrieve the data isnt seeming to display it at all. I cant seem to see what the problem might be considering all other functions have been built similarly to this one. What I have is listed below:

def show_user_homepage(request):
    user1 = request.user
    status = StatusUpdate.objects.filter(status_user=user1).order_by('status_date_time')[1:]
    context = RequestContext(request,{'user':user1,'status':status})
    return render_to_response('users/index.html',context_instance=context)

Template section for status display for function is:

        <div id="current-status">
            <p>
                Status:
                <span class="italics">
                    {% if status.status_id %}
                        {{ status.status_text }}
                    {% else %}
                        No status currently available
                    {% endif %}
                </span>
            </p>
        </div>

The class for the Status is:

class StatusUpdate(models.Model):
    status_id = models.AutoField(primary_key=True)
    status_user = models.ForeignKey(User)
    status_text = models.CharField(max_length=2000)
    status_date_time = models.DateTimeField(auto_now_add=True)

def __unicode__(self):
    return '%s' % self.status_text

No matter what Ive tried, the status part in the template always says there isnt a status available. Thanks for any help.

  • 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-21T11:10:35+00:00Added an answer on May 21, 2026 at 11:10 am

    list[1:] will return elements from 1 to the end. So your status variable is not a single status but a list of statuses and a list does not have the attribute status_id

    to get the last one use [-1]

    Update:

    You can also use django function latest(http://docs.djangoproject.com/en/dev/ref/models/querysets/#latest)

    StatusUpdate.objects.filter(status_user=user1).latest('status_date_time')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just finished building a website for client, instantinteriors.com.au . (Visit this site
I'm building a website using HTML 5 markup, but have hit a problem regarding
I am trying to learn Spring framework by building simple website, now I have
I am building a website that is loaded into a frameset by other sites
I am building a website which loads some collada objects for each area. But
I am building a website www.etutornetwork.com, in top menu I have included a link
I am just building website for our client. It is simple page which lists
I'm building a website that just allow each person in my office to access
I'm building a website with very small amounts of Javascript, just to add things
If you are building a simple website using just simple HTML/CSS/Javascript that has say

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.