6. Admin

When you want to use a Translated Model in the Django admin, you have to subclass hvad.admin.TranslatableAdmin instead of django.contrib.admin.ModelAdmin.

6.1. New methods



A method that can be used in list_display and shows a list of languages in which this object is available. Entries are linked to their corresponding admin page.


You should add prefetch_related(‘translations’) to your queryset if you use this in list_display, else one query will be run for every item in the list.

6.2. ModelAdmin APIs you should not change on TranslatableAdmin

Some public APIs on django.contrib.admin.ModelAdmin are crucial for hvad.admin.TranslatableAdmin to work and should not be altered in subclasses. Only do so if you have a good understanding of what the API you want to change does.

The list of APIs you should not alter is:


If you wish to alter the template used to render your admin, use the implicit template fallback in the Django admin by creating a template named admin/<appname>/<modelname>/change_form.html or admin/<appname>/change_form.html. The template used in django-hvad will automatically extend that template if it’s available.


Use hvad.admin.TranslatableAdmin.form instead, but please see the notes regarding Forms in admin.


The only thing safe to alter in this method in subclasses is the context, but make sure you call this method on the superclass too. There’s three variable names in the context you should not alter:

  • title
  • language_tabs
  • base_template


Just don’t try to change this.


If you alter this method, make sure to call it on the superclass too to prevent duplicate objects to show up in the changelist or change views raising django.core.exceptions.MultipleObjectsReturned errors.

6.3. Forms in admin

If you want to alter the form to be used on your hvad.admin.TranslatableAdmin subclass, it must inherit from hvad.forms.TranslatableModelForm. For more informations, see Forms.

6.4. ModelAdmin APIs not available on TranslatableAdmin

A list of public APIs on django.contrib.admin.ModelAdmin which are not implemented on hvad.admin.TranslatableAdmin for handling translatable fields, these APIs should continue to work as usual for non-translatable fields.

  • actions [1]
  • date_hierarchy [1]
  • fieldsets [1]
  • list_display [1]
  • list_display_links [1]
  • list_filter [1]
  • list_select_related [1]
  • list_ediable [1]
  • prepopulated_fields [1]
  • search_fields [1]


[1](1, 2, 3, 4, 5, 6, 7, 8, 9, 10) This API can only be used with Shared Fields.