Django-hvad translate model of django-rest-framework

225
January 31, 2018, at 5:47 PM

I'm trying to implement django-hvad on a django app but I'm getting an error when I'm trying to launch python manage.py runserver :

File "/Users/Philippe/Documents/DjangoApp/env/lib/python3.6/site-packages/hvad/manager.py", line 265, in _clone
    return super(TranslationQueryset, self)._clone(**kwargs)
TypeError: _clone() got an unexpected keyword argument 'shared_model'

Did I made any mistakes to translate my models? Thanks for your help!

models.py

class Opponent(TranslatableModel):
    name = models.CharField(max_length=255, unique=True, null=True)
    companyType = models.ForeignKey(CompanyType, on_delete=models.SET_NULL, blank=True, null=True, related_name='opponents')
    pricing = models.ManyToManyField(Pricing, blank=True)
    translations = TranslatedFields(
        description = models.TextField(null=True, blank=True)
    )
    def __str__(self):
        return "{}" .format(self.name)
    def save(self, *args, **kwargs):
        super(Opponent, self).save(*args, **kwargs)  # Call the "real" save() method.

serializers.py

class OpponentSerializer(TranslatableModelSerializer):
    class Meta:
        model = Opponent
        fields = '__all__'

views.py

class OpponentViewSet(viewsets.ModelViewSet):
    queryset = Opponent.objects.language().all()
    serializer_class = OpponentSerializer
    def get_queryset(self):
        user_language = self.request.GET.get('language')
        return Opponent.objects.language(user_language).all()
Rent Charter Buses Company
READ ALSO
PyDrive copy file This file cannot be copied by the authenticated user(Python)

PyDrive copy file This file cannot be copied by the authenticated user(Python)

Sorry for my englishI try copy files to another folder

344
Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”: http://landinghub.visualst udio.com/visual-cpp-build-tools

Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”: http://landinghub.visualst udio.com/visual-cpp-build-tools

I have tried all methods mentioned on the internet but there is no useI am trying to install misaka by writing pip install misaka it keeps complaining by showing the same message

433
name: __file__ is not defined

name: __file__ is not defined

it gives name: __file__ not defined error

507
Convert Java to Python using cx_Oracle SQL/XML query

Convert Java to Python using cx_Oracle SQL/XML query

I have an existing solution in Java to extract data from an Oracle databaseI do it like so:

320