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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:17:59+00:00 2026-05-14T20:17:59+00:00

This is my model: class Author(models.Model): first_name = models.CharField(max_length=200) last_name = models.CharField(max_length=200) middle_name =

  • 0

This is my model:

class Author(models.Model):

    first_name = models.CharField(max_length=200)
    last_name = models.CharField(max_length=200)
    middle_name = models.CharField(max_length=200, blank=True)

    def __unicode__(self):
        return full_name

    def _get_full_name(self):
        "Returns the person's full name."
        if self.middle_name == '':
            return "%s %s" % (self.first_name, self.last_name)
        else:
            return "%s %s %s" % (self.first_name, self.middle_name, self.last_name)
    full_name = property(_get_full_name)

Everything is fine except when I go into admin interface, I see

TemplateSyntaxError at /bibbase2/admin/bibbase2/author/
Caught an exception while rendering: global name ‘full_name’ is not defined

It seems like the built-in admin app doesn’t work with a property field. Is there something wrong with my code?

  • 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-14T20:17:59+00:00Added an answer on May 14, 2026 at 8:17 pm
    def __unicode__(self):
            return full_name
    

    Should be:

    def __unicode__(self):
            return self.full_name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my model: class News(models.Model): title = models.CharField(max_length=250) text = models.TextField() pub_date =
I've got a Django model called Author , with a field called name ,
I have 2 models with a many-to-many relationship (simplified here with books-authors example): class
I have a class Book : from django.db import models from users.models import User
I have read through Scott Hanselman's post on this topic. I found another article
Two questions please: I need two foreign keys back to User, one for author
I'm using this tutorial to get internal messages working on my site: http://www.novawave.net/public/rails_messaging_tutorial.html But,
I am using Django ModelForms to create a form. I have my form set
Hi I've got problem with foreach statement. I have my controller method: public ActionResult
Consider a book shelf, it has shelves and each shelf has a number of

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.