Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    osxisl
    @osxisl
    Hi, is this chat alive?
    partizan
    @last-partizan
    yes
    Dor Bar
    @dorb4r

    Hey! I have got the Error: cannot import FieldDoesNotExist from "django.db.models"

    I see you merged a fix for that. When will we be able to install it using pip?

    Dor Bar
    @dorb4r
    Just opened an issue for that:
    deschler/django-modeltranslation#561
    partizan
    @last-partizan
    Hi, i'll take a llok right now.
    Released.
    Gikta_python
    @sweetpythoncode
    Hi, is this chat alive?
    partizan
    @last-partizan
    @sweetpythoncode same level of aliveness as github issues, but this is better place to ask questions.
    partizan
    @last-partizan
    @sweetpythoncode so, you want to create a book, with english translation set by default? if it's your default language, you can just create it with objects.create(). And if you want to set fields directly, you use objects.create(title_en="The Little Prince")
    vishal sharma
    @vishal2612200
    Hi Team, Does modeltranslation also support the Hindi language?
    partizan
    @last-partizan
    @vishal2612200 is there something unusual about Hindi? it must work for everything, you just add translations into database
    vishal sharma
    @vishal2612200
    Do I have to add translations manually? I was assuming that it automatically add translations after django-modeltranslation command.
    partizan
    @last-partizan
    @vishal2612200 no, this is module for allowing you to translate fields in your own models
    vishal sharma
    @vishal2612200

    I have some existing project, But when I tried to use modeltranslation it generated an empty field for the model. After that, I tried modeltranslation command to fill out an empty field but it simply populated the empty field with original data, not with a translated version of original data.

    @last-partizan is something that I am missing out.

    I don't know why the translated version of the original data doesn't add up to the newly generated fields.

    @last-partizan How can I get out from this problem.

    Is there any previous project example on GitHub that have used modeltranslation in it, So that I can take out a reference from that. It would be really helpful for me.
    partizan
    @last-partizan
    @vishal2612200 modeltranslation does not translate your data, you must do it yourself.
    vishal sharma
    @vishal2612200

    Thanks, @last-partizan, Great to have a talk with you. Now I have the answer to my most of the answers to the question.

    I have already read out the whole documentation, All contributors have done great work. Thanks for your contribution to open-source.

    partizan
    @last-partizan
    @vishal2612200 you're welcome! :)
    vishal sharma
    @vishal2612200
    :)
    vishal sharma
    @vishal2612200

    @last-partizan , How can I use the field that I was using before the modeltranslation.

    For example,

    In setting.py, I have defined the following thing,

    LANGUAGES = (

          ('hi', gettext('Hindi')),          

    )

    So after this my templates are showing 'hi' fields,

    for example, they are showing the content of 'title_hi', but I want to show 'title' content, not 'title_hi', how can I do this?

    I don't want the '_hi' should overtake my original content.

    partizan
    @last-partizan
    @vishal2612200 you should add two languages, one of which is the language of original text
    vishal sharma
    @vishal2612200
    Okay, Thanks @last-partizan :)
    vishal sharma
    @vishal2612200

    Hi @last-partizan ,

    I have some queries related to the django-rest-framework method integration with django-modeltranslation.

        def get_queryset(self):
            user_language = self.request.GET.get('language')
            return Model.objects.get_language(user_language).all()

    For example, can I get particular language data similar to this '?language=en'?

    partizan
    @last-partizan

    @vishal2612200 hi

    django-modeltranslation uses current language from django, i suppose it's better to use something like LocaleMiddleware

    https://docs.djangoproject.com/en/3.1/ref/middleware/#module-django.middleware.locale

    or if you want direct approach, something like this:

    def list(self, request, ...):
        lang = ...
        with translation.activate(lang):
            return super().list(request, ...)
    vishal sharma
    @vishal2612200
    Thanks, @last-partizan, It worked for me:)
    Suhrob Malikov
    @malikovss
    hi there!
    how should be my model serializer? any example?
    please can u help me. I couldn't find from google
    partizan
    @last-partizan
    @malikovss Hi. Just normal model serializer, nothing special i think.
    partizan
    @last-partizan
    Q: What does base-class approach mean in the documentation? #579
    A: Using base class, like "TranslatableModel" for all your translated models.