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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:06:31+00:00 2026-05-29T15:06:31+00:00

I am using callable for a read-only field in Django admin, like this: class

  • 0

I am using callable for a read-only field in Django admin, like this:

class ItemAdmin(admin.ModelAdmin):
    fields = ('real_value','estimated_value', )
    readonly_fields = ('estimated_value', )

class Item(models.Model):
    real_value = models.CharField(... , verbose_name=u'a nice label')

    def get_estimated_value(self):
        return ...some value...
    estimated_value = property(get_estimated_value)

Now, I just want to add some nice label for estimated_value to admin form. Can this be (reasonably) done? 🙂

  • 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-29T15:06:32+00:00Added an answer on May 29, 2026 at 3:06 pm

    Here is an exmaple

    class ItemForm(forms.ModelForm):
        estimated_value = forms.CharField(max_length=10)
        class Meta:
            model = Item
        def __init__(self, *args, **kwargs):
            super(ItemForm, self).__init__(*args, **kwargs)
            if kwargs.has_key('instance'):
                instance = kwargs['instance']
                self.initial['estimated_value'] = instance.estimated_value
    

    Then add that form to the admin

    class ItemAdmin(admin.ModelAdmin):
        model = Item
        form = ItemForm
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To quote PHP: Anonymous functions are currently implemented using the Closure class. This is
Are only the core Ruby methods callable using object.functionName syntax? Is it possible to
I created a pretty basic Django project using django-admin and I'm now running into
I'm using django 1.0 and have a method in views.py that starts out like
I have a COM Callable Wrapper that I'm using from a VB6 program, but
What is the difference between using the Runnable and Callable interfaces when designing a
I have the following code in D import std.stdio; class Thing { // Fields
I am executing a Callable Object using ExecutorService thread pool. I want to give
I've been using Callable , but now I need the function to use a
DUPLICATE: Using a Django custom model method property in order_by() I have two models;

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.