Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

270
Views
Creating Custom Forms in the Django Admin Interface with Parler

I have a django 1.8 instance (and python 2) and I am using django-parler for translation. I want to customize the admin interface (I want to use django-autocomplete-light, but that's not relevant). But customizing the admin interface with parler seems a bit more tricky then I thought. Here is a reduced example.

models.py

from django.db import models
from parler.models import TranslatableModel, TranslatedFields


class Fruits(TranslatableModel):
    translations = TranslatedFields(
        fname=models.CharField(max_length=200)
    )

    def __unicode__(self):
        return self.fname

forms.py

from dal import autocomplete
from django import forms

from .models import Fruits

class FruitsForm(forms.ModelForm):
    class Meta:
        model = Fruits
        fields = (
            'fruits',
        )

admin.py

from django.contrib import admin
from parler.admin import TranslatableAdmin

from .forms import FruitsForm
from .models import Fruits


class FruitsAdmin(TranslatableAdmin):
    form = FruitsForm
    model = Fruits


admin.site.register(Fruits, FruitsAdmin)

The Problem

django.core.exceptions.FieldError: Unknown field(s) (fruits) specified for Fruits

What can I do?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

EDIT #1:

After a bit of searching around, I believe that you have to make your form inherit from parler.formsTranslatableModelForm in order to work as expected.

Change your FruitsForm to match the following:

from dal import autocomplete
from django import forms
from parler.forms import TranslatableModelForm

from .models import Fruits

class FruitsForm(TranslatableModelForm):
    class Meta:
        model = Fruits
        fields = (
            'fname',
        )

In case of fname giving you the same issue, try to set fields='__all__'

Good luck :)

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!