Skip to content

Instantly share code, notes, and snippets.

@beniwohli
Created July 13, 2012 12:02
Show Gist options
  • Save beniwohli/3104553 to your computer and use it in GitHub Desktop.
Save beniwohli/3104553 to your computer and use it in GitHub Desktop.
workaround example for fieldsets in hvad admin
class MyModelAdmin(TranslatableAdmin)
list_display = ('title', 'is_published')
use_fieldsets = (
(_("Common"), {
'fields': (('is_published',)
}),
(_("Language dependent"), {
'fields': ('name', 'slug',),
}),
)
def get_fieldsets(self, request, obj=None):
return self.use_fieldsets
class MyModel(TranslatableModel):
is_published = models.BooleanField()
translations = TranslatedFields(
name = models.CharField(max_length=100),
slug = models.SlugField(max_length=100),
)
def __unicode__(self):
return self.safe_translation_getter('name', unicode(self.pk))
@stphivos
Copy link

Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment