Giter Club home page Giter Club logo

Comments (2)

etianen avatar etianen commented on June 2, 2024

Thanks for taking the time to explain your problem!

django-reversion might not be the best tool for what you're trying to do. It's made a few design decisions that go against your goals:

  1. django-reversion stores all past versions using the django serialization framework. This means it works with any model and any model field, but the downside is that it becomes very slow to go through past versions of a model looking for a particular property (e.g. state).

  2. django-reversion assumes only the "latest" version of an object is interesting, and all other versions exist for auditing and rollback. This decision is again optimized for ease of integration with any model, but it does narrow the use-cases.

In your case, you want to easily be able to access two versions of a model:

  • The latest APPROVED version.
  • The latest PENDING version.

I think you'll have a better long-term experience, and much better performance, by building this logic into your database table itself.

from django-reversion.

josidridolfo avatar josidridolfo commented on June 2, 2024

Hi! Sorry for the delay and thanks for your response!

Re: design decisions - if anyone else is considering using django-reversion for a use case similar to my own, please heed @etianen's advice and build the logic required into the database itself. It's probably a good idea to have - for any Object that requires a state or other attributes similar to my use case as described above - a separate ObjectHistory table.

This blog post here was extremely helpful for me; it might be for you, too: https://kaustavdm.in/versioning-content-postgresql/

@etianen - once again, thank you for building and maintaining this, and thank you for sharing your wisdom on how to get better performance and guidance re: design!

from django-reversion.

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.