Giter Club home page Giter Club logo

django-hvad's Introduction

django-hvad build

Model translations made easy.

This project replaces the obsolete django-nani package.

This is yet another project to make model translations suck less in Django. It uses an automatically created Translations Model to store translatable fields in arbitrary languages with a foreign key to the main model.

Feel free to join us at #django-hvad on irc.freenode.net for a chat

Features

  • Simple API - less than 10 new methods.
  • Reliable - more than 200 test cases and counting. build
  • Versatile - can manipulate arbitrary languages without changing the DB schema.
  • Complete - supports relationships, proxy models, and - from v0.5 - abstract models.
  • Fast - few and simple queries
  • High level - no custom SQL Compiler or other scary things
  • Batteries included - translation-enabled forms and admin are provided.
  • Compatible with Django 1.3 to 1.7, running Python 2.6+ or 3.3+.

Warning

Although we focus on keeping the code stable and clean even on the development branch, django-hvad is still in beta. Please use it with caution and report any bug you might encounter on the issue tracker. If stability is critical, stick to packaged releases and explicitly prevent automatic upgrades to next branch (e.g. put django-hvad>=0.4,<0.5 in your requirements).

Releases

Starting from v0.4, django-hvad uses the same release pattern as Django. The following versions are thus available:

  • Stable branch 0.4, available through PyPI and git branch releases/0.4.x.
  • Development branch 0.5, available through git branch master.

See the installation guide for details, or have a look at the release notes.

Example Use

Books.objects.all()

Returns all objects, but without any translated fields attached - this query is just the default django queryset and can therefore be used as usual.

Books.objects.language().all()

Returns all objects as translated instances, but only the ones that are translated into the currect language. You can also specify which language to get, using e.g.

Books.objects.language("en").all()

Usual queryset methods work as usual: let's get all books as translated instances, filtering on the translatable title attribute, returning those that have Petit Prince in their French title, ordered by publication date (in their French edition):

Books.objects.language("fr").filter(title__contains='Petit Prince').order_by('publish_date')

More examples in the quickstart guide.

Thanks to

Jonas Obrist (https://github.com/ojii) for making django-nani and for helping me with this project.

django-hvad's People

Contributors

akx avatar andialbrecht avatar beniwohli avatar bertrandbordage avatar bradenmacdonald avatar clelland avatar czpython avatar evildmp avatar eyvoro avatar fladi avatar gabejackson avatar krisb78 avatar kristianoellegaard avatar meshy avatar mkoistinen avatar ojii avatar ollb avatar qris avatar rasca avatar semekh avatar shaib avatar spectras avatar sphericalhorse avatar stefanfoulis avatar superdmp avatar xordoquy avatar yakky avatar

Watchers

 avatar

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.