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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:41:47+00:00 2026-05-20T04:41:47+00:00

Hey, i need a little help with this django function. I wan’t to insert

  • 0

Hey, i need a little help with this django function. I wan’t to insert it into base.html but i cant .. How ?

def my_friends(request):
friendships = request.user.profile.friendships.exclude(pending=True).order_by('-friend__user__last_activity_date')
friendshipsQS = friendships
results = tuplify(friendships.all(), n=3)
return render(request, 'base.html', locals())
  • 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-20T04:41:48+00:00Added an answer on May 20, 2026 at 4:41 am

    Accept Answers

    You can’t just set up a view that renders base.html and hope everything that extends it will use that view as well.

    You need to use something like a Context Processor to inject values into every context.
    http://docs.djangoproject.com/en/dev/ref/templates/api/#writing-your-own-context-processors

    def FriendsContextProcessor(request):
        """
        Include Friendships in all RequestContext
        """
        friendships = request.user.profile.friendships.exclude(pending=True).order_by('-friend__user__last_activity_date')
        friendshipsQS = friendships
        results = tuplify(friendships.all(), n=3)
        return { 'results': results, 'friendshipsQS': friendshipsQS }
    

    add python.dot.path.to.my.FriendsContextProcessor to your TEMPLATE_CONTEXT_PROCESSORS setting and the dictionary returned above will be available in all RequestContext, which apparently render(...) does for you! Does that mean you’re using trunk?

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

Sidebar

Related Questions

Hey, need a little help here. I have two models: class User < ActiveRecord::Base
Hey all i am in need of a little help with figuring out how
Ok, I need help. This is my first question here. Background: I am working
Hey guys, have a little issue i need to figure out. I created a
Hey guys, I have a little issue here. I need my users to be
Hey all, i am new at everything VB.net/ASP.net so i need some help with
Hey gang, I need to know if i need to restart my computer to
Hey, i'm extending some WPF controls, and need to implement some custom events. I've
Hey all, I have something of an interesting requirement for my project. I need
Hey all, my Computational Science course this semester is entirely in Java. I was

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.