Skip to content
Snippets Groups Projects
Commit 9196809f authored by Dylann Cordel's avatar Dylann Cordel :crossed_swords:
Browse files

fix non unique slug in i18n

parent 95977c42
Branches 0.4
Tags 0.4.4
No related merge requests found
......@@ -20,12 +20,17 @@ class NewsboxI18NManager(TranslatableManager, NewsboxManager):
def newsboxi18n_mcls_processor(mcls, class_name, class_bases, class_attrs, base, newsbox_opts):
translatedFields={}
translatedFields = {}
for trans_field in newsbox_opts['trans_fieldnames']:
translatedFields[trans_field] = class_attrs.pop(trans_field)
translatedFields['meta'] = {
'unique_together': (('newsbox_slug', 'language_code'), ),
'verbose_name': _('News translation'),
'verbose_name_plural': _('News translations')
}
class_attrs['translations'] = TranslatedFields(**translatedFields)
class_attrs['newsbox_objects'] = NewsboxI18NManager()
#class_attrs['default_manager'] = class_attrs['newsbox_objects']
# class_attrs['default_manager'] = class_attrs['newsbox_objects']
class NewsboxI18NModelBase(NewsboxModelBase):
......@@ -89,5 +94,5 @@ class NewsboxI18NBase(six.with_metaclass(NewsboxI18NModelBase, TranslatableModel
abstract = True
verbose_name = _('news')
verbose_name_plural = _('news')
#newsbox_metaclass_base_processor = 'newsboxi18n_mcls_processor'
# newsbox_metaclass_base_processor = 'newsboxi18n_mcls_processor'
newsbox_metaclass_final_processor = 'newsboxi18n_mcls_processor'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment