Giter Club home page Giter Club logo

Comments (14)

bradleyayers avatar bradleyayers commented on May 18, 2024

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.

christhekeele avatar christhekeele commented on May 18, 2024

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.

bradleyayers avatar bradleyayers commented on May 18, 2024

You what's the get_table_data method you're passing into the class?
You shouldn't need that.

from django-tables2.

christhekeele avatar christhekeele commented on May 18, 2024

That's commented out, my bad.

from django-tables2.

bradleyayers avatar bradleyayers commented on May 18, 2024

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.

christhekeele avatar christhekeele commented on May 18, 2024

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.

bradleyayers avatar bradleyayers commented on May 18, 2024

Well you're using KiwiListView in your urls.py, but you showed me KiwiIndexView, could you should me KiwiListView?

from django-tables2.

christhekeele avatar christhekeele commented on May 18, 2024

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.

christhekeele avatar christhekeele commented on May 18, 2024

(BaseGenericActionView being ExtraContextMixin. Made a lot of typos in that pastie.)

from django-tables2.

bradleyayers avatar bradleyayers commented on May 18, 2024

Well it would seem its something in extracontextmixin

from django-tables2.

christhekeele avatar christhekeele commented on May 18, 2024

Found it, thanks

from django-tables2.

bradleyayers avatar bradleyayers commented on May 18, 2024

Great :)

from django-tables2.

christhekeele avatar christhekeele commented on May 18, 2024

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.

christhekeele avatar christhekeele commented on May 18, 2024

Might be an issue with the pull request patch. Gonna check on the BoundRows later.

from django-tables2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.