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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:37:46+00:00 2026-05-18T10:37:46+00:00

I have a field name that is automatically constructed from first_name and last_name in

  • 0

I have a field “name” that is automatically constructed from “first_name” and “last_name” in one of the subclasses:

from django.db import models
from django.utils.translation import ugettext_lazy as _

class Actor(models.Model):
    name = models.CharField(_('name'), max_length=60)

class Company(Actor):
    pass

class Person(Actor):
    first_name = models.CharField(_('first name'), max_length=30, blank=True)
    last_name = models.CharField(_('last name'), max_length=30, blank=True)
    email = models.EmailField(_('e-mail address'), unique=True)

    def save(self, *args, **kwargs):
        if self.first_name or self.last_name:
            self.name = (self.first_name + ' ' + self.last_name).strip()
        else:
            self.name = self.email
        super(Person, self).save(*args, **kwargs)

I would like the “name” field to be editable in the Actor and Company models, but not in the Person model. How can I accomplish that?

I can’t override the field definition by adding

name = models.CharField(_('name'), max_length=60, editable=False)

to the Person model because Django raises a FieldError (“Local field ‘name’ in class ‘Person’ clashes with field of similar name from base class ‘Actor'”).

  • 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-18T10:37:46+00:00Added an answer on May 18, 2026 at 10:37 am

    Forget about editable and exclude the field in the model’s ModelAdmin instead:

    from django.contrib import admin
    
    admin.site.register(Person, exclude=['name'])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a field in my form labeled Name that will contain both the
At the moment I have a combobox that is populated from the name fields
I have a user table 'users' that has fields like: id first_name last_name ...
I have two forms: one that takes user information (name, birthdate, etc): formA. And
I have a ModelForm field that is based on the following Model: class Phrase(models.Model):
I have a app that searches a database and retrieves 3 fields Name, Email
I have a a gridpanel that has the following fields: Name ID Address Home_Phone
Supposing that I have millions of user profiles, with hundreds of fields (name, gender,
I have a DataTemplate that is displaying objects with three fields, e.g.: Name =
i have table called as Support, which have a field named Name and contains

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.