ojii / django-multilingual-ng

THIS PROJECT IS *NOT* SUPPORTED AND SHOULD NOT BE USED UNLESS YOU KNOW EXACTLY WHAT YOU'RE DOING!!!

Home Page:https://github.com/KristianOellegaard/django-hvad

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Model meta ordering error

meme-zz opened this issue · comments

Hi,

When I put for example "title" field into Translation class, I can't use it in some Model.Meta option like: ordering, unique_together etc..

Error:
"ordering" refers to "title", a field that doesn't exist

Is any possibility to omit this error?

Thanks,
regards.

This is an issue I'm aware of (actually ordering worked for us but caused other issues). I'll try to look into this when I have time.

I'll try to look into this when I have time.

I'll be very obliged :-)

I also need this functionnality to be working ...

Hello (again :-)

Is any possibility to fix this bug soon?

Thank You.

the highest chance of getting it fixed is if you look into the issue yourself and fix it...

As far as I see, the problem is the validation in Site.register() in django.contrib.admin.sites. It will only run in debug mode, so probably this would simply work in production mode ;)

I can make a fix for that, but I wonder what is the best solution. Do you think we should code a separate register function for multilingual models and instead of calling django.contrib.admin.site.register(Model, Admin) call multilingual.admin.site.register(Model, Admin)?

I think it's quite logical, but I'd be happy to hear other suggestions.

Or maybe it's not needed after all. I'll dig a bit more into the code.

An alternative would be to force people to put the ordering field in a Meta inner class inside the Translation inner class if it refers to a translatable field. I don't know how easy it would be to make it actually work in the Manager.

Yes, but either solution requires extra LOC :)

I'll see if I have some spare time at work next week to look into that.

Did anyone ever get anywhere with this issue?

Yes (but only with ordering I guess):
https://github.com/hint/django-multilingual-ng

You can put ordering inside Translation.Meta class.

One issue that we didn't fix yet, is that it breaks dumpdata - but if you need dumpdata, you can temporarily disable this ordering flag.