diff --git a/pedagogy/forms.py b/pedagogy/forms.py index 57b75385..6510f8b6 100644 --- a/pedagogy/forms.py +++ b/pedagogy/forms.py @@ -27,7 +27,7 @@ from django import forms from core.views.forms import MarkdownInput from core.models import User -from pedagogy.models import UV +from pedagogy.models import UV, UVComment class UVForm(forms.ModelForm): @@ -68,3 +68,13 @@ class UVForm(forms.ModelForm): super(UVForm, self).__init__(*args, **kwargs) self.fields["author"].queryset = User.objects.filter(id=author_id).all() self.fields["author"].initial = author_id + + +class UVCommentForm(forms.ModelForm): + """ + Form handeling creation and edit of an UVComment + """ + + class Meta: + model = UVComment + fields = () diff --git a/pedagogy/templates/pedagogy/uv_detail.jinja b/pedagogy/templates/pedagogy/uv_detail.jinja new file mode 100644 index 00000000..2385c473 --- /dev/null +++ b/pedagogy/templates/pedagogy/uv_detail.jinja @@ -0,0 +1,13 @@ +{% extends "core/base.jinja" %} + +{% block title %} +{% trans %}UV Details{% endtrans %} +{% endblock %} + +{% block content %} +

{{ object.code }} - {{ object.title }}

+

{{ object.objectives|markdown }}

+

{{ object.program|markdown }}

+

{{ object.skills|markdown }}

+

{{ object.key_concepts|markdown }}

+{% endblock %} \ No newline at end of file diff --git a/pedagogy/views.py b/pedagogy/views.py index 3b344228..ca01bc29 100644 --- a/pedagogy/views.py +++ b/pedagogy/views.py @@ -41,7 +41,7 @@ from core.views import ( CanEditPropMixin, ) -from pedagogy.forms import UVForm +from pedagogy.forms import UVForm, UVCommentForm from pedagogy.models import UV # Some mixins @@ -71,13 +71,16 @@ class CanCreateUVFunctionMixin(View): # Acutal views -class UVDetailFormView(DetailFormView): +class UVDetailFormView(CanViewMixin, CanCreateUVFunctionMixin, DetailFormView): """ Dispaly every comment of an UV and detailed infos about it Allow to comment the UV """ - pass + model = UV + pk_url_kwarg = "uv_id" + template_name = "pedagogy/uv_detail.jinja" + form_class = UVCommentForm class UVCommentDetailView(DetailView):