-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Table inheritance do not keep column option #337
Comments
Hmm, that seems to be the case indeed. Pushed a failing tests to branch issue-337 based on your example. Will look into it, thanks for reporting! |
@nimch This is what happens: The metaclass converts the explicit and implicit columns of I'll think about a way to fix this, in the mean time: in this case there is no need to define |
Unfortunately, your proposal don't solve my issue. I still get "default" verbose_names. |
@nimch interesting, I did exactly that here, which makes the build pass |
Hello, I'm back ! I'm not convinced of your test code... Where is MyTable definition for example ? I redo tests with minimalist code to be sure (and not my more complex code hacked). #!/usr/bin/env python3
from django.db import models
from django_tables2 import Table, Column
class MyModel(models.Model):
item1 = models.CharField()
class MyTable(Table):
item1 = Column(verbose_name="nice verbose name")
class Meta:
per_page = 20
model = MyModel
fields = ('item1',)
class MyTableExt(MyTable):
item2 = Column(verbose_name="nice verbose name too")
class Meta(MyTable.Meta):
per_page = 22 Here Python shell :
As you can see, verbose name defined in MyTable is lost in MyTableExt. |
The diff was collapsed which made the The tests run in CI against django 1.8 in python 2.7, 3.3 and 3.4. Your version of django-tables2 shouldn't matter but it would keep things more clear if you upgraded to the latest version. I just noticed why it fails in your example and works in mine: if you have no |
Empty Meta class is not allowed so test fails, this is correct. Same behaviour here : without any definition of Meta in child class, parent class fields' verbose_name are preserved. Well, inheritance without the ability of modifying Meta option is less useful, no ? Do you consider this is normal behaviour ? Thanks for your help. |
It does not fail on it being empty, the test fails on a failed assertion. I do consider it a bug (issue is still open), but didn't have the time to fix it yet. If you have time and skill to fix it, feel free to open a pull request! |
Hi ! |
@nimch thanks for verifying! |
Hi there !
First, thank you for sharing your work.
Second, the issue : when inherit from personal Table class, it seems that Column arguments (like verbose_name, orderable, etc) are not kept, right ?
Example:
In MyTableExt, item1 do not have "Nice column name", always right ?
Thanks.
The text was updated successfully, but these errors were encountered: