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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:23:25+00:00 2026-05-13T12:23:25+00:00

I have a model looking like this. class ProjectMembership(models.Model): member = models.ForeignKey(User, related_name=’project_membership_member_set’) Edit:

  • 0

I have a model looking like this.

class ProjectMembership(models.Model):
    member = models.ForeignKey(User, related_name='project_membership_member_set')

Edit: In a template I want now to access the last_name of the User model. I thought it should work like the following line, but it does not.

{{ project_membership.member.last_name }}

No error is provided. Just the value is missing. I just want to print out the first and last name of the User object referenced in the variable member. Interestingly

{{ project_membership.member }}

does work. This prints out the “human-readable” representation of the User object.

  • 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-13T12:23:25+00:00Added an answer on May 13, 2026 at 12:23 pm

    If project_membership.member gives you the user, then project_membership.member.last_name should give you that user’s last_name.

    Are you absolutely sure that the user you’re testing for has last_name set? Do you get any output on project_membership.member.username? If you try to access project_membership.member.last_name in your view or through the shell, do you get an error or an empty unicode string?

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

Sidebar

Related Questions

I have a report model looking a bit like this: class Report(models.Model): date =
Let's say I have two models looking like this: class ProductType(models.Model): product_type = models.CharField(max_length=100)
I have following setup. from django.db import models from django.contrib.auth.models import User class Event(models.Model):
I have a form looking like this: class MarketingActionForm(forms.ModelForm): contact = ManyToManyByLetter(Contact, field_name=first_name) #contact
If I have a model named Client and controller that looks like this class
I have an object model that looks like this: public class MyObjectModel { public
I have an object model like this: public class MyClass { int TheProp {get;set;}
Say I have a SqlAlchemy model something like this: from sqlalchemy.ext.declarative import declarative_base from
Let's say I have this object: [JsonObject] public class User { [JsonProperty(PropertyName = id)]
I have the following models (simplified): class Location(models.Model): name = models.CharField(max_length=100) is_ok = models.BooleanField()

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.