Giter Club home page Giter Club logo

Comments (4)

saxix avatar saxix commented on May 17, 2024 1

you are right, the issue happen in the "preview" step. Not sure about your solution, as this could cause the form (and the record) will not validate.
I'm going to add the feature to 'skip' the preview and add a note to use it if ProtectedError happen.

from django-adminactions.

mitchelljkotler avatar mitchelljkotler commented on May 17, 2024

Any update on this?

from django-adminactions.

mitchelljkotler avatar mitchelljkotler commented on May 17, 2024

I need this functionality and would be willing to write a PR if it will be merged in. I would like some explanation for this code from the preview step:

with transaction.nocommit():
    form = MForm(request.POST, instance=master)
    other.delete()
form_is_valid = form.is_valid()

I understand you are deleting the other instance, then validating the master model, and then rolling back the transaction. But I do not understand why - why do you need to validate the master instance with the other instance deleted?

from django-adminactions.

saxix avatar saxix commented on May 17, 2024

the intention is to invoke model validation, and display errors in a proper way. Using a form Django calls full_clean() and validate_unique() on master. This is needed to check that the new instance can be properly saved.

from django-adminactions.

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.