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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:26:37+00:00 2026-05-19T09:26:37+00:00

Easiest said with pictures. I’m not sure how to create the 2nd column with

  • 0

Easiest said with pictures.

alt text

I’m not sure how to create the 2nd column with the button. Then how to add an id so that the button runs code for the specific record.

  • 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-19T09:26:38+00:00Added an answer on May 19, 2026 at 9:26 am

    Although I think actions are better, if you really need a button, here’s the easiest way:

    Define a function that returns an HTML button in your model. How a view handles that button action is your call and just like any other view.

    One idea is to link to a specific URL like /restart/3/ (if this button is performing a safe operation) or put form elements in each button that POSTs to a separate view with <input type="hidden" name="id" value="%(the_id)s" />

    # models.py
        def restart_button(self):
            return '<a href="restart/%s">Restart Me</a>' % (self.id) 
        restart_button.allow_tags = True
    
    # admin.py
    list_display = ('restart_button', ...)
    
    def get_urls(self):
        # use get_urls for easy adding of views to the admin
        urls = super(MyModelAdmin, self).get_urls()
        my_urls = patterns('',
            (r'^restart/(?P<id>\d)$', self.restart)
        )
        return my_urls + urls
    
    def restart(self, request, id):
        MyModel.objects.get(id=id).restart()
        request.user.message_set.create(message="%s restarted." % id)
        return http.HttpResponseRedirect('../')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It seems to be often said that Task Manager does not provide an accurate
The easiest way to explain this problem is to show you some code: Public
What would be the easiest way of creating a Python server (XML-RPC Server) that
What is the easiest way to quote bash command arguments that contain single quotes
I've said it before and I'll say it again, the easiest examples for WPF
What is the easiest way to pass along BASIC authentication credentials that are currently
Easiest to explain this with code: http://jsfiddle.net/fjZfL/37/ I want it to be like who
The easiest way to see the problem is checking the code here: http://www.studioimbrue.com/beta What
I would like to create a simple notification icon that would display a number
Easiest way to explain what I mean is with a code sample. This doesn't

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.