i have some class in tables.py:
import django_tables2 as tables
from django_tables2.utils import A
from .models import Messageclass MessageTable(tables.Table):
message_text = tables.LinkColumn('mssgs:detail', text=lambda record: record.message_text, args=[A('pk')])
group = tables.LinkColumn('grps:detail', text=lambda record: record.group, args=[A('group.pk')])
class Meta:
model = Message
attrs = {'class': 'table table-bordered'}
fields = ['message_text', 'group', 'date_create']in other app i want to inherit this class without group-column:
from mssgs.tables import MessageTableclass GroupMessageTable(MessageTable):
class Meta:
fields = ['message_text', 'date_create']or
from mssgs.tables import MessageTableclass GroupMessageTable(MessageTable):
class Meta(MessageTable.Meta):
fields = ['message_text', 'date_create']or
from mssgs.tables import MessageTableclass GroupMessageTable(MessageTable):
class Meta(MessageTable.Meta):
fields = ['message_text', 'date_create']
exclude = ['group']but group-column is not hiding..
How to inherit Meta class?
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/516dd643-50b1-4860-a287-b0eb558390e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment