Skip to content
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

A non-field based LinkColumn always renders long dash #257

Closed
singalen opened this issue Jul 30, 2015 · 4 comments
Closed

A non-field based LinkColumn always renders long dash #257

singalen opened this issue Jul 30, 2015 · 4 comments
Labels

Comments

@singalen
Copy link

I see a pretty erratic behavior in BoundRow.__getitem__. It doesn't account for a LinkColumn that is not based on a field, which is pretty normal thing.
My field was declared as

delete_link = tables.LinkColumn(
    'order_delete',
    kwargs={'customer_pk': tables.A('customer.id'), 'pk': tables.A('id')}
)

and due to mentioned method was always rendered as an empty value.

Adding

    accessor=tables.A('id'),

helped, but it's clearly a workaround. The column doesn't have to be data-based at all.

@singalen
Copy link
Author

Or this should be a part of documentation: http://stackoverflow.com/a/24346861/207791. But better fix the logic.

@jieter jieter added the docs label Dec 16, 2015
@jieter
Copy link
Owner

jieter commented Dec 29, 2015

I agree this is not a well defined API. Any idea's how to make it nicer?

@singalen
Copy link
Author

For the sake of the least surprise, I would just fix BoundRow.__getitem__ to account for None in bound_column.accessor, and supply no or empty value as available['value'].

@jieter
Copy link
Owner

jieter commented Dec 29, 2015

@singalen sounds good, care to provide a patch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants