Comments (14)
I'm sorry the docs are a bit shit, it's something I'm aware of but I guess I'm just not very good at writing them⦠Next: you should be using v0.10.0, I'm not sure why you thought 0.2.0 is the latest? Have a look at SinlgeTableMixin https://github.com/bradleyayers/django-tables2/blob/master/django_tables2/views.py#L56 it's pretty straight forward. The way it gets data to populate the table is by calling get_queryset()
. I'm happy to look over a paste of your class.
from django-tables2.
Sorry, persistant paste error--I'm running 0.10.0. (So many 'django-app' named apps!)
It must be my own misunderstanding of generic views, because I have no idea where to make use of the get_queryset method in my code... Better find some example with more demonstrations than the djangodocs.
The sandbox I've been working in looks pretty simple right now.
from django-tables2.
You what's the get_table_data method you're passing into the class?
You shouldn't need that.
from django-tables2.
That's commented out, my bad.
from django-tables2.
Okay so get_queryset
is one of te methods already implemented in ListView
, it's what's called to produce the value used to populate the object_list
context variable. Django-tables2 uses this method as a sensible default. So all you should need to do in your class based view is define model
or queryset
(or pass them in to as_view()
)
from django-tables2.
Gotcha. I do specify model in my urls.py, which is producing the queryset called object_list, so I haven't screwed up the ListView somehow. I've removed the ExtraContextMixin with no effect. On the SingTableMixin side, hasattr(KiwiListView, "get_queryset") evals to true, and no errors are being thrown. So, looking at the get_table_data method, I must somehow be giving it a non null self.table_data somehow. This is almost certainly my own issuse, so I'm going to close this--thanks for your time, and let me know if you have any thoughts on why table_data might be non-null.
from django-tables2.
Well you're using KiwiListView
in your urls.py
, but you showed me KiwiIndexView
, could you should me KiwiListView
?
from django-tables2.
One's mixins are (BaseGenericActionView, SingleTableMixin, ListView), the other's mixins are (BaseGenericActionView, SingleTableView). They're functionally interchangeable, and the problem persists with either.
from django-tables2.
(BaseGenericActionView being ExtraContextMixin. Made a lot of typos in that pastie.)
from django-tables2.
Well it would seem its something in extracontextmixin
from django-tables2.
Found it, thanks
from django-tables2.
Great :)
from django-tables2.
Removed the ExtraContent (which was not overriding get_context_data properly). Got into the nitty gritty and checked how the table data was flowing through the views.
It's making its way all the way down to rendering the table node. In the middle of the hack, I can verify the queryset is there with a print context.get("table").data.queryset
. But the output of template.render(context)
is still only the header of the table, sans queryset data.
from django-tables2.
Might be an issue with the pull request patch. Gonna check on the BoundRows later.
from django-tables2.
Related Issues (20)
- Duplicate on Record sometimes switch column detail HOT 1
- Add the ability to swap the underlying exporter
- SingleTableView table_data attribute not same as get_query over write
- Custom column attribute change default datetime formar HOT 2
- Missing type hints HOT 1
- Cannot set delimiter on CSV export HOT 2
- Building the docs at readthedocs still fails HOT 2
- Is it possible to add attributes to the links in the th? HOT 6
- Duplicate count() on class based views.
- Disable User-sortable Columns HOT 1
- request object in render_FOO methods moved?
- 500 error by adding negative per_page query to a model based table
- SQL queries are duplicated when mixing in with MultipleObjectMixin-based views e.g. django-filter
- render() should have *args, **kwargs as param HOT 2
- feature: example for checkbox selection and a submit action (e.g) adding to a basket/chart HOT 2
- feature: CRUD example table HOT 1
- search is down on docs HOT 3
- Feature request: Make TemplateColumn more dynamic HOT 2
- pagination with elasticsearch-dsl HOT 1
- Feature Request: Allow args/kwargs to be passed to a callable with an Accessor HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-tables2.