translation.py 833 B

123456789101112131415161718192021222324252627282930
  1. from modeltranslation.translator import translator, TranslationOptions
  2. from core import models
  3. class StateTranslationOptions(TranslationOptions):
  4. fields = ('name',)
  5. class PartyTranslationOptions(TranslationOptions):
  6. fields = ('name', 'shortname',)
  7. class CategoryTranslationOptions(TranslationOptions):
  8. fields = ('name',)
  9. class QuestionTranslationOptions(TranslationOptions):
  10. fields = ('text', 'description',)
  11. class LinkTypeTranslationOptions(TranslationOptions):
  12. fields = ('name',)
  13. translator.register(models.State, StateTranslationOptions)
  14. translator.register(models.Party, PartyTranslationOptions)
  15. translator.register(models.Category, CategoryTranslationOptions)
  16. translator.register(models.Question, QuestionTranslationOptions)
  17. translator.register(models.LinkType, LinkTypeTranslationOptions)