django-translated-fields | Django model translation without magic-inflicted pain | Translation library

 by   matthiask Python Version: 0.13.0 License: BSD-3-Clause

kandi X-RAY | django-translated-fields Summary

kandi X-RAY | django-translated-fields Summary

django-translated-fields is a Python library typically used in Utilities, Translation applications. django-translated-fields has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can install using 'pip install django-translated-fields' or download it from GitHub, PyPI.

Django model translation without magic-inflicted pain.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              django-translated-fields has a highly active ecosystem.
              It has 92 star(s) with 13 fork(s). There are 3 watchers for this library.
              There were 1 major release(s) in the last 6 months.
              There are 1 open issues and 24 have been closed. On average issues are closed in 135 days. There are 1 open pull requests and 0 closed requests.
              It has a positive sentiment in the developer community.
              The latest version of django-translated-fields is 0.13.0

            kandi-Quality Quality

              django-translated-fields has no bugs reported.

            kandi-Security Security

              django-translated-fields has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              django-translated-fields is licensed under the BSD-3-Clause License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              django-translated-fields releases are not available. You will need to build from source code and install.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.

            Top functions reviewed by kandi - BETA

            kandi has reviewed django-translated-fields and discovered the below as its top functions. This is intended to give you an instant insight into django-translated-fields implemented functionality, and help decide if they suit your requirements.
            • Fallback to the given field
            • Convert name to attribute name
            • Fallback to default
            • Creates a getter for the given field name
            • Creates a setter for the given field name
            Get all kandi verified functions for this library.

            django-translated-fields Key Features

            No Key Features are available at this moment for django-translated-fields.

            django-translated-fields Examples and Code Snippets

            No Code Snippets are available at this moment for django-translated-fields.

            Community Discussions

            QUESTION

            Multilingual slug with django-translated-fields
            Asked 2020-Apr-26 at 06:41

            I am trying to implement a multilingual Django website with help of django-translated-fields.

            The project I am working on is based on cookiecutter-django and Docker.

            The translation works fine for my model fields – except the slug filed. Actually translation of slug works as well but I am not able to take slug field for getting one single entry.

            Excerpt of voting model:

            ...

            ANSWER

            Answered 2019-May-12 at 18:43

            Not sure if this is the right way but with help of Django Documentation “How Django discovers language preference” I came to following solution.

            Changing the voting view as follows:

            Source https://stackoverflow.com/questions/55983013

            QUESTION

            Using forms with django-translated-fields
            Asked 2020-Apr-26 at 06:40

            Please take a look at this issue:

            How do I use ModelForm with django-translated-fields?

            Do you have any solution?

            In short, I'm trying to convert Speedy Net from using django-modeltranslation to django-translated-fields. I defined the models and forms and everything works in English, but in another language (Hebrew) I have a problem that the form fields are defined in English instead of Hebrew (the current language). What did I do wrong and how do I define the form to work in the current language? (the fields defined by TranslatedField in the model should be visible only with the current language in the form SpeedyMatchProfileActivationForm).

            I want to clarify that the desired definition is not as above. The desired definition is to use the current language in the form and not always English. Using English when the current language is not English is a bug.

            You can see the code here:

            tree

            forms.py

            models.py

            The problem right now is with the class SpeedyMatchProfileActivationForm (defined in forms.py). I think it is mainly because the class is defined before get_language() returns anything. But when the class was defined with django-modeltranslation (for example in branch staging), it worked.

            By the way, one of the reasons I want to switch to django-translated-fields is because it defines only 2 (the number of languages) fields in the database, and django-modeltranslation defines 3 fields - one of them (the main field without any language) seems to me not necessary at all. Take a look at: Remove original language field on migrations

            class SpeedyMatchProfileActivationForm is defined now (with django-translated-fields, link):

            ...

            ANSWER

            Answered 2019-Mar-30 at 10:19

            I found a solution. It's not the optimal solution but it works. I added the fields in all languages to the form. The fields we don't need are already removed in the __init__ method.

            Source https://stackoverflow.com/questions/55419601

            QUESTION

            Django ModelForm - Is there a way to define fields dynamically, but not as the last field?
            Asked 2020-Apr-26 at 06:39

            I have a ModelForm with Django 2.1, and I moved a few fields to another model. Calling make_migrations causes an error because these fields don't exist in the current model. I added some of the fields to the form, but one of the fields is a TranslatedField (from django-translated-fields) and therefore there are currently 2 fields, and in the future there might be more, depending on the number of languages. The name of the field is city, and currently I get an error message "Unknown field(s) (city_en, city_he) specified for SiteProfile" (because I'm using 2 languages - "en" and "he") - but I want to create all the fields dynamically with a for loop over the languages we use in the project. Can I override (and is it a good programming method) the __new__ method or is there another way? I prefer not to hard-code the specific field names (city_en and city_he) because they may change in the future, depending on how many languages we use.

            You can see my current commit (not working) on GitHub.

            And the current code of this branch.

            I would like to know what is the best programming method to define a dynamic list of fields (which are all identical, and only one of them will be used, the other are removed in the __init__ method) in a ModelForm where the fields are saved in another model (there are 2 models but only one form).

            I still didn't commit the migrations because of this error when running make_migrations.

            (I defined a command make_migrations which only does makemigrations)

            The form (with my trying to override __new__):

            ...

            ANSWER

            Answered 2019-Aug-15 at 15:06

            I don't know if this will help but I have a survey application where different users want different information on the background information form. I provide it via a json file. So within the form I have

            Source https://stackoverflow.com/questions/56973508

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install django-translated-fields

            You can install using 'pip install django-translated-fields' or download it from GitHub, PyPI.
            You can use django-translated-fields like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • PyPI

            pip install django-translated-fields

          • CLONE
          • HTTPS

            https://github.com/matthiask/django-translated-fields.git

          • CLI

            gh repo clone matthiask/django-translated-fields

          • sshUrl

            git@github.com:matthiask/django-translated-fields.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link