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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:40:19+00:00 2026-06-09T21:40:19+00:00

How to tell django-tables2 which columns I would like to have in table? I

  • 0

How to tell django-tables2 which columns I would like to have in table? I know there is this Column attribute ‘visible’, which can be set to False.
However I have a model with many fields, and would like to display just some of them, so writing a complete list of all columns, just to tell that most of them will not be visible, does not seem the right approach.

What I am looking for is a way to provide list of column names to be displayed, if this is possible then maybe even give user the ability to select which columns he wants.

The other solution came to my mind – make that ‘visible’ attribute False by default, but since it is defined in Column class, I would still need to write a complete list.

Since I have not found any django-tables2 discussion forum, I ask here.

  • 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-09T21:40:21+00:00Added an answer on June 9, 2026 at 9:40 pm

    Example of specifying model fields

    Your Model

    class Product(model.Models):
        name = model.CharField(max_length=20)
        price = model.DecimalField(max_digit=9, decimal_places=2)
    

    Your Table

    class ProductTable(tables.Table):
        actions = ProductActions(orderable=False) # custom tables.Column()
        class Meta:
            model = Product
            fields = ('name', 'price', 'action') # fields to display
    

    Also you can also use exclude

    Related docs entry here

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

Sidebar

Related Questions

Simple question. I have bunch of django views. Is there a way to tell
I have a basic question, in the Django template language how can you tell
I have two models like this: class Collar(models.Model): num_tags = models.BigIntegerField() class Dog(models.Model): num_legs
I'd like to love Django, but this business of static and media files in
Is there a way to tell django not to follow a foreign key relationship
New to Django so it's probable I'm doing this all wrong. I have an
I'm trying to learn Django and I would like feedback from anyone who has
Is there an easy way to tell Django's runserver to override a single variable
Can someone please tell what this strange error is Mod_python error: PythonHandler django.core.handlers.modpython Traceback
I upgraded to django 1.2 and I now get this error message which looks

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.