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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:48:43+00:00 2026-06-17T08:48:43+00:00

I belive that the answer to my problem is simple, but I can’t find

  • 0

I belive that the answer to my problem is simple, but I can’t find it anywhere. Here is my predicament. I have two models: Member and MemberDetail, which are in oneToOne relation like this:

class Member(models.Model):
   ID = models.AutoField(primary_key=True)
   FIRST_NAME = models.CharField('First name', max_length=50)
   LAST_NAME = models.CharField('Last name', max_length=50)
   def __unicode__(self):  
      return u'%s %s' % (self.FIRST_NAME, self.LAST_NAME)

class MemberDetail(models.Model):
   member = models.OneToOneField(Member, primary_key=True)
   DATE_OF_BIRTH = models.DateField('Date of birth')
   EMAIL = models.EmailField('E-mail')
   PHONE = models.CharField('Phone', max_length=15)

Now in my admin.py I want to show table for member with all of his data, like this:

class MemberDetailInline(admin.TabularInline):
    model = MemberDetail

class MemberAdmin(admin.ModelAdmin):
    list_display = ("FIRST_NAME", "LAST_NAME", "date_of_birth", "email", "phone")
    inlines = [
        MemberDetailInline,
    ]

admin.site.register(Member, MemberAdmin)

I simply don’t know how to write “date_of_birth”, “email” and “phone” part of list_display. The closest thing I could do is adding this after inlines:

def date_of_birth(self, MemberDetail):
    return MemberDetail.DATE_OF_BIRTH
def date_of_birth(self, MemberDetail):
    return MemberDetail.EMAIL
def date_of_birth(self, MemberDetail):
    return MemberDetail.PHONE

but the fields showed empty on page. What is the solution? Thanks.

  • 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-17T08:48:44+00:00Added an answer on June 17, 2026 at 8:48 am

    Finally!!! I solved it. As I thought it was simple, but I had to do it other way around and with multi table inheritance:

    models.py
    class Member(models.Model):
        ID = models.AutoField(primary_key=True)
        FIRST_NAME = models.CharField('First name', max_length=50)
        LAST_NAME = models.CharField('Last name', max_length=50)
    
    # Using multi table inheritance - automaticly creates one to one field
    class MemberDetail(Member):
        DATE_OF_BIRTH = models.DateField('Date of birth')
        EMAIL = models.EmailField('E-mail')
        PHONE = models.CharField('Phone', max_length=15)
    

    Now for admin.py

    admin.py
    class MemberDetailAdmin(admin.ModelAdmin):
        list_display = ("FIRST_NAME", "LAST_NAME", "DATE_OF_BIRTH", "EMAIL", "PHONE")
    
    admin.site.register(MemberDetail, MemberDetailAdmin)
    

    That’s it. Maybe, there is other solutions, but this is good for me.

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

Sidebar

Related Questions

This seems like a simple problem but I can't seem to find the answer.
I used to believe that any variable that is shared between two threads, can
So here I believe I have a small buffer overflow problem I found when
I've been searching for an answer to this and can't seem to find it.
I have a simple parsing program that takes a few files and combines them.
I have a problem that I am a bit stuck on and I was
I am having an issue that I believe can be resolved with a simple
I believe that the Hamiltonian cycle problem can be summed up as the following:
I have, what I believe to be a simple question with a simple answer
I have a simple login page but i am having trouble displaying the logged

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.