# Path: answers/models.py
# class Answer(PolymorphicModel):
#     created_on = models.DateTimeField(_("Created on"), auto_now_add=True)
#     updated_on = models.DateTimeField(_("Updated on"), auto_now=True)
#     question = models.ForeignKey(Question, verbose_name=_("Question"), on_delete=models.PROTECT)
#     userprofile = models.ForeignKey(
#         UserProfile, verbose_name=_("User"), on_delete=models.PROTECT, blank=True, null=True, default=None)
#     review = models.ForeignKey(Review, verbose_name=_(
#         "Review"), on_delete=models.PROTECT, blank=True, null=True, default=None)
# 
#     class Meta:
#         verbose_name = _("Answer")
#         verbose_name_plural = _("Answers")
# 
#     def __str__(self):
#         return self.question.title
# 
# class TextAnswer(Answer):
#     answer = models.CharField(_("Answer"), max_length=255)
# 
#     class Meta:
#         verbose_name = ("Text Answer")
#         verbose_name_plural = ("Text Answers")
# 
#     def __str__(self):
#         return self.question.title
# 
# class MultipleChoiceAnswer(Answer):
#     answer = models.ForeignKey(
#         MultipleChoiceOption, verbose_name=_("Answer"), on_delete=models.PROTECT)
# 
#     class Meta:
#         verbose_name = _("Multiple Choice Answer")
#         verbose_name_plural = _("Multiple Choice Answers")
# 
#     def __str__(self):
#         return self.question.title
# 
# class EssayAnswer(Answer):
#     answer = models.TextField(_("Answer"))
# 
#     class Meta:
#         verbose_name = _("Essay Answer")
#         verbose_name_plural = _("Essay Answers")
# 
#     def __str__(self):
#         return self.question.title
# 
# class RatingAnswer(Answer):
#     # choices
#     VERY_POOR = 1
#     POOR = 2
#     AVERAGE = 3
#     GOOD = 4
#     VERY_GOOD = 5
# 
#     RATING_CHOICES = (
#         (VERY_POOR, _('Strongly Disagree')),
#         (POOR, _('Disagree')),
#         (AVERAGE, _('Neither Agree Nor Disagree')),
#         (GOOD, _("Agree")),
#         (VERY_GOOD, _("Strongly Agree")),
#     )
# 
#     answer = models.PositiveIntegerField(_("Answer"), choices=RATING_CHOICES)
# 
#     class Meta:
#         verbose_name = _("Rating Answer")
#         verbose_name_plural = _("Rating Answers")
# 
#     def __str__(self):
#         return self.question.title
# 
# class BooleanAnswer(Answer):
#     answer = models.BooleanField(_("Answer"))
# 
#     class Meta:
#         verbose_name = _("Boolean Answer")
#         verbose_name_plural = _("Boolean Answers")
# 
#     def __str__(self):
#         return self.question.title


from django.contrib import admin
from polymorphic.admin import PolymorphicParentModelAdmin
from answers.models import Answer, TextAnswer, MultipleChoiceAnswer, EssayAnswer, RatingAnswer, BooleanAnswer
    pass


class EssayAnswerAdmin(admin.ModelAdmin):
    pass


class RatingAnswerAdmin(admin.ModelAdmin):
    pass


class BooleanAnswerAdmin(admin.ModelAdmin):
    pass


class AnswerAdmin(PolymorphicParentModelAdmin):
    base_model = Answer
    list_display = ['question', 'userprofile', 'review']
    list_filter = ['review']

    child_models = (
        (TextAnswer, TextAnswerAdmin),
        (MultipleChoiceAnswer, MultipleChoiceAnswerAdmin),
        (EssayAnswer, EssayAnswerAdmin),
        (RatingAnswer, RatingAnswerAdmin),
        (BooleanAnswer, BooleanAnswerAdmin),
    )


admin.site.register(Answer, AnswerAdmin)

# Path: answers/models.py
# class Answer(PolymorphicModel):
#     created_on = models.DateTimeField(_("Created on"), auto_now_add=True)
#     updated_on = models.DateTimeField(_("Updated on"), auto_now=True)
#     question = models.ForeignKey(Question, verbose_name=_("Question"), on_delete=models.PROTECT)
#     userprofile = models.ForeignKey(
#         UserProfile, verbose_name=_("User"), on_delete=models.PROTECT, blank=True, null=True, default=None)
#     review = models.ForeignKey(Review, verbose_name=_(
#         "Review"), on_delete=models.PROTECT, blank=True, null=True, default=None)
# 
#     class Meta:
#         verbose_name = _("Answer")
#         verbose_name_plural = _("Answers")
# 
#     def __str__(self):
#         return self.question.title
# 
# class TextAnswer(Answer):
#     answer = models.CharField(_("Answer"), max_length=255)
# 
#     class Meta:
#         verbose_name = ("Text Answer")
#         verbose_name_plural = ("Text Answers")
# 
#     def __str__(self):
#         return self.question.title
# 
# class MultipleChoiceAnswer(Answer):
#     answer = models.ForeignKey(
#         MultipleChoiceOption, verbose_name=_("Answer"), on_delete=models.PROTECT)
# 
#     class Meta:
#         verbose_name = _("Multiple Choice Answer")
#         verbose_name_plural = _("Multiple Choice Answers")
# 
#     def __str__(self):
#         return self.question.title
# 
# class EssayAnswer(Answer):
#     answer = models.TextField(_("Answer"))
# 
#     class Meta:
#         verbose_name = _("Essay Answer")
#         verbose_name_plural = _("Essay Answers")
# 
#     def __str__(self):
#         return self.question.title
# 
# class RatingAnswer(Answer):
#     # choices
#     VERY_POOR = 1
#     POOR = 2
#     AVERAGE = 3
#     GOOD = 4
#     VERY_GOOD = 5
# 
#     RATING_CHOICES = (
#         (VERY_POOR, _('Strongly Disagree')),
#         (POOR, _('Disagree')),
#         (AVERAGE, _('Neither Agree Nor Disagree')),
#         (GOOD, _("Agree")),
#         (VERY_GOOD, _("Strongly Agree")),
#     )
# 
#     answer = models.PositiveIntegerField(_("Answer"), choices=RATING_CHOICES)
# 
#     class Meta:
#         verbose_name = _("Rating Answer")
#         verbose_name_plural = _("Rating Answers")
# 
#     def __str__(self):
#         return self.question.title
# 
# class BooleanAnswer(Answer):
#     answer = models.BooleanField(_("Answer"))
# 
#     class Meta:
#         verbose_name = _("Boolean Answer")
#         verbose_name_plural = _("Boolean Answers")
# 
#     def __str__(self):
#         return self.question.title


# Path: answers/admin.py
from django.contrib import admin
from polymorphic.admin import PolymorphicParentModelAdmin
from answers.models import Answer, TextAnswer, MultipleChoiceAnswer, EssayAnswer, RatingAnswer, BooleanAnswer

    pass


class EssayAnswerAdmin(admin.ModelAdmin):
    pass


class RatingAnswerAdmin(admin.ModelAdmin):
    pass


class BooleanAnswerAdmin(admin.ModelAdmin):
    pass


class AnswerAdmin(PolymorphicParentModelAdmin):
    base_model = Answer
    list_display = ['question', 'userprofile', 'review']
    list_filter = ['review']

    child_models = (
        (TextAnswer, TextAnswerAdmin),
        (MultipleChoiceAnswer, MultipleChoiceAnswerAdmin),
        (EssayAnswer, EssayAnswerAdmin),
        (RatingAnswer, RatingAnswerAdmin),
        (BooleanAnswer, BooleanAnswerAdmin),
    )


admin.site.register(Answer, AnswerAdmin)

admin.site.register(TextAnswer, TextAnswerAdmin)