Created
July 13, 2012 12:02
-
-
Save beniwohli/3104553 to your computer and use it in GitHub Desktop.
workaround example for fieldsets in hvad admin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!!