from MMTest.mathmodels.models import MathModel
from MMTest.bindings.models import Binding
from MMTest.core.crud_views import CreateEntityView, EntityDetails
from MMTest.core.crud_views import DeleteEntity, UpdateEntity
from .models import MMTest
from .forms import MMTestForm


class CreateMMTest(CreateEntityView):
    model = MMTest
    form_class = MMTestForm
    parent_entity = MathModel


class MMTestDetails(EntityDetails):
    model = MMTest
    pk_url_kwarg = 'mmtest_pk'
    related_entities = [Binding]


class DeleteMMTest(DeleteEntity):
    model = MMTest
    pk_url_kwarg = 'mmtest_pk'
    parent_entity = MathModel


class UpdateMMTest(UpdateEntity):
    model = MMTest
    pk_url_kwarg = 'mmtest_pk'
    form_class = MMTestForm
