Giter Club home page Giter Club logo

Comments (2)

brodriguez8774 avatar brodriguez8774 commented on September 25, 2024

This very much could get very expensive very fast. 100% agree that IF we implement this, we would need settings to limit how deep/expensive it can get.

Also, for clarification, when would this be called? Is it some kind of additional JavaScript that dynamically calls relations as the user clicks elements on the DD page? Is it called during initial model/query processing, as part of initial DD-page middleware computations? Some in between?

I feel like these details should be determined BEFORE we would try to implement such logic. So it's very clear what our goal is before we start work on it.

from django-dump-die.

brodriguez8774 avatar brodriguez8774 commented on September 25, 2024

For clarification, this original issue post is specifically regarding M2M relations, with the select_related and prefetch_related options. It seems they (maybe?) don't output, or don't output in useful ways by default? Need to verify exactly what the output is. Either way, if we implement this, we probably want to also double check output of standard FK/one-to-one relations, and verify they output in DD how we want. Just so all model relations are handled consistently and how we want.


Anyways, after discussing this further, it sounds like we're leaning on two options:

  1. Easier Option - Add another optional kwarg to the dd functions. When provided, will first verify that the provided object is a Django query, and then do some additional logic to ensure nicer output, using the kwarg values.

  2. More Complicated Option - Implement with some sort of JS/AJAX calls. So the relation will display in the original DD output, but the actual data will not persist to the page until the user clicks to expand the given attribute. At which point some sort of JS will trigger to pull whatever the value is, and then render the result to the page.


Option 1 is much easier to implement, but much less dynamic. In that it requires the user to know what relations they care about in advance. If they don't know, then they need to load the initial dd page, figure out what they want to see, then modify the initial call and reload the dd page for the new data.

Option 2 will probably have lower upfront cost for page rendering, and is very dynamic in that the user can have no idea what they're expecting to see, and yet they can still get to the data they ultimately want. But it will take significantly more work to implement, and we're not sure we want to invest that amount of extra time into this package.

These two options are not mutually exclusive and we can potentially do both if we want.

from django-dump-die.

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.