zmathew / django-linguo Goto Github PK
View Code? Open in Web Editor NEWLinguo is a Django application that provides the ability to have multilingual models.
License: BSD 3-Clause "New" or "Revised" License
Linguo is a Django application that provides the ability to have multilingual models.
License: BSD 3-Clause "New" or "Revised" License
I'm on Django 2.1.
This error appears on trying makemigrations
with a basic model:
from django.db import models
from django.utils.translation import ugettext as _
# 2nd party
from linguo.models import MultilingualModel # used for internationalization of models
from linguo.managers import MultilingualManager # used for internationalization of models
# Create your models here.
class Chapter(MultilingualModel):
number = models.IntegerField(verbose_name=_('number'))
title = models.CharField(max_length=255, verbose_name=_('title'))
class Meta:
translate = ('number', 'title')
Hey I was wondering if its okay by you to add a use case for translating urls for models using the slug field and get_absolute_url for an object. I know its possible and all but I think a documented use case of how this can be achieved would help explain. Let me know what you think and I can create a pull request.
When using Linguo with Django 1.8, I receive the following error:
AttributeError: 'NoneType' object has no attribute 'split'
there's no tags for 1.3.1 or 1.3.2, the latest release was 1.3.0. I'm trying to use this is a pip requirements file (I know 1.3.2 is in pypi but I don't see 1.3.0 listed there, if I had django-linguo==1.3.0
in my requirements.txt it wouldn't work)
As the docs says
from linguo.forms import MultilingualModelForm
when I was trying it, it threw an ImportError, when I was looking why, I saw that the forms didn't come with the package.
So i've used the github version, and I noticed that what the forms do is the default behavior of linguo in the admin
# settings.py
LANGUAGES = (
('en', ugettext('English')),
('fr', ugettext('French')),
)
# models.py
from linguo.models import MultilingualModel
from linguo.managers import MultilingualManager
class Product(MultilingualModel):
name = models.CharField(max_length=255, verbose_name=_('name'))
description = models.TextField(verbose_name=_('description'))
price = models.FloatField(verbose_name=_('price'))
objects = MultilingualManager()
class Meta:
# name and description are translatable fields
translate = ('name', 'description')
# admin.py
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from mysite.models import Product
class ProductAdmin(admin.ModelAdmin):
fieldsets = (
(_('Product Identification'), {'fields': ('name', 'name_fr', 'description', 'description_fr')}),
(_('Price'), {'fields': ('price',)}),
)
list_display = ('name', 'name_fr', 'description', 'description_fr', 'price')
admin.site.register(Product, ProductAdmin)
Above setup allow user who has LANGUAGE_CODE == 'en'
to edit Product name and description in both languages, but user who has LANGUAGE_CODE == 'fr'
cannot do it (both name and name_fr contain French version). In the fieldsets and list_display I cannot use name_en and description_en.
Thank you!
Hello, manager.py not found, please replace manager to managers!
https://github.com/zmathew/django-linguo/blob/master/linguo/models.py#L11
Hi,
I'm trying to integrate a hierarchical models (django-mptt) with django-linguo.
class BaseModel(MultilingualModel):
code = models.CharField(max_length=10)
name = models.CharField(max_length=500, blank=True)
description = models.TextField(blank=True)
# class Meta(MultilingualModel.Meta):
class Meta:
abstract = True
translate = ('name', 'description')
class ConcreteModel(MPTTModel, BaseModel):
pass
When I try to start django, gives me this error:
metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.