Code Monkey home page Code Monkey logo

Comments (6)

vdboor avatar vdboor commented on May 29, 2024

Good point! That information is hidden from the untranslated model/form, so it makes sense the admin doesn't check this. I think we'll have to override the Model.validate_unique() method, to add this additional check.

Sending a pull request is welcome, if you like to have this fix in django-parler quickly! 👍

from django-parler.

yakky avatar yakky commented on May 29, 2024

I'm struggling to find the best approach to this.
In the clean phase, the shared model has no access to the translated models (TranslatableModel._translations_cache is still empty / populated with the original values of the translated models), and in the Model.save() phase is too late for the form to catch and manage the ValidationError.
The only stable solution would be to managed the translated models via a ModelForm, but I admit I got lost in the chain of on-the-fly models and form creation process

from django-parler.

jrief avatar jrief commented on May 29, 2024

@vdboor
It would be great, if you could add that extra meta argument to the documentation for the TranslatedFields. Today I came to the same solution as @yakky pointed out, by reading the source code.

@yakky
do you think it is safe to apply the patch from PR #22 ?

from django-parler.

yakky avatar yakky commented on May 29, 2024

I'm running #22 on a couple of websites with no issue raised
If @vdboor likes it I can rebase it anytime

from django-parler.

vdboor avatar vdboor commented on May 29, 2024

Hi @yakky! Sorry for not getting back to this before! Based on your comment, I think the solution could be a bit more improved. After that we can merge. Shall we continue the discussion in #22?

from django-parler.

yakky avatar yakky commented on May 29, 2024

@vdboor sure

from django-parler.

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.