У меня есть проект фреймворка django с уже созданными моделями, и я пытаюсь добавить django-modeltranslation в проект.Я следовал процессу, как указано в документации по django-modeltranslation, но приложения перестают работать после выполнения миграций с изменениями django-modeltranslation.
Каждый раз, когда я пытаюсь получить доступ к базе данных, через страницу администратора или страницу структуры отдыха django, Я получаю ошибку с приложениями, к которым я добавил transalation.py
файл.Приложения без него продолжают работать.
Это моя модель:
class Country(models.Model):
name = models.CharField(max_length=40, unique=True, verbose_name=_('Name'))
code = models.CharField(max_length=5, verbose_name=_('Code'))
calling_code = models.CharField(max_length=3, null=True, blank=True, verbose_name=_('Calling code'))
class Meta:
verbose_name = _('Country')
verbose_name_plural = _('Countries')
def __str__(self):
return self.name
Это моя translation.py
@register(models.Country)
class CountryTranslationOptions(TranslationOptions):
fields = ('name',)
И это весь трассировщик ошибкиЯ получаю:
Internal Server Error: /es/general/countries/
Traceback (most recent call last):
File "/Users/hugovillalobos/Documents/Code/IntellibookProject/IntellibookVenv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
response = get_response(request)
File "/Users/hugovillalobos/Documents/Code/IntellibookProject/IntellibookVenv/lib/python3.6/site-packages/django/core/handlers/base.py", line 128, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/hugovillalobos/Documents/Code/IntellibookProject/IntellibookVenv/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/hugovillalobos/Documents/Code/IntellibookProject/IntellibookVenv/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/Users/hugovillalobos/Documents/Code/IntellibookProject/IntellibookVenv/lib/python3.6/site-packages/rest_framework/viewsets.py", line 103, in view
return self.dispatch(request, *args, **kwargs)
File "/Users/hugovillalobos/Documents/Code/IntellibookProject/IntellibookVenv/lib/python3.6/site-packages/rest_framework/views.py", line 483, in dispatch
response = self.handle_exception(exc)
File "/Users/hugovillalobos/Documents/Code/IntellibookProject/IntellibookVenv/lib/python3.6/site-packages/rest_framework/views.py", line 443, in handle_exception
self.raise_uncaught_exception(exc)
File "/Users/hugovillalobos/Documents/Code/IntellibookProject/IntellibookVenv/lib/python3.6/site-packages/rest_framework/views.py", line 480, in dispatch
response = handler(request, *args, **kwargs)
File "/Users/hugovillalobos/Documents/Code/IntellibookProject/IntellibookVenv/lib/python3.6/site-packages/rest_framework/mixins.py", line 40, in list
queryset = self.filter_queryset(self.get_queryset())
File "/Users/hugovillalobos/Documents/Code/IntellibookProject/IntellibookVenv/lib/python3.6/site-packages/rest_framework/generics.py", line 74, in get_queryset
queryset = queryset.all()
File "/Users/hugovillalobos/Documents/Code/IntellibookProject/IntellibookVenv/lib/python3.6/site-packages/django/db/models/query.py", line 829, in all
return self._chain()
File "/Users/hugovillalobos/Documents/Code/IntellibookProject/IntellibookVenv/lib/python3.6/site-packages/django/db/models/query.py", line 1156, in _chain
obj = self._clone()
File "/Users/hugovillalobos/Documents/Code/IntellibookProject/IntellibookVenv/lib/python3.6/site-packages/modeltranslation/manager.py", line 234, in _clone
return super(MultilingualQuerySet, self)._clone(**kwargs)
TypeError: _clone() got an unexpected keyword argument '_rewrite'
[05/Jun/2018 15:54:13] "GET /es/general/countries/ HTTP/1.1" 500 99097
Буду признателен за любую помощь.