Git Product home page Git Product logo

django-mothertongue's People

Contributors

emesik avatar robcharlwood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

django-mothertongue's Issues

__getattribute__ override causing multiple database hits

django-mothertongue's abstract model overrides the getattribute() method to return attributes of a translated model. This is causing multiple hits to the database even when returning the same attribute for the second time.

We need to find a way to reduce these hits possibly by overriding the getattr() method instead. This issue is no show stopper for sites receiving small or medium amounts of traffic but could become an issue on heavy traffic websites and so this does need fixing.

Showing the translated value of a field in admin site instead of the original

Hi,

I’ve used this application for a website and after putting it in production I noticed a wrong behavior that might need a correction.

The website supports English and French, English being the default and setup language. I’ll illustrate the problem on the GenericPage model example. (http://packages.python.org/django-mothertongue/usage.html). I create an instance of that model from the admin page with the corresponding French translation. On the site the correct values are showed of the page depending on the browser settings or the url. I can also easily modify the content of the page from the admin site. My browser has English as the preferred language. Everything is fine at this point. Now a colleague, who has French locale set in his browser, connects to the admin site to modify the page I previously created. The interface is in French as expected, but when he gets to the change form of the GenericPage instance, both the original fields and the translation inline have the same values. If he saves the changes, the default English fields are overwritten as well as the inline. Then, if we configure another language, the Russian for example, the administrator who’ll have Russian locale will see the Russian values in the original form and two inlines, Russian and French, but never the English as expected. The only way to solve this is to always manually change the URL to English (en), losing the translated admin site, which is not very inconvenient and error prone.

Would there be a quick fix to this? As the only thoughts I could think of was to in a way to override the ModelAdmin.change_view() to force the retrieval of the correct values or make some custom processing on the Middleware level.

Thanks in advance for any help.

Cheers,

max_len in language field at docs

In docs there is example of using django-mothertongue

# chunks translations model
class GenericPageTranslation(models.Model):
    generic_page_instance = models.ForeignKey('GenericPage', verbose_name=_('generic_page'))
    language = models.CharField(max_length=len(settings.LANGUAGES)-1, choices=settings.LANGUAGES[1:])

Field language should have max_length = 10 (оr greather), but not len(settings.LANGUAGES)-1

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.