mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-26 11:04:20 +00:00
pedagogy: basic uv detail view
This commit is contained in:
parent
ab344ba02f
commit
1172402166
@ -27,7 +27,7 @@ from django import forms
|
|||||||
from core.views.forms import MarkdownInput
|
from core.views.forms import MarkdownInput
|
||||||
from core.models import User
|
from core.models import User
|
||||||
|
|
||||||
from pedagogy.models import UV
|
from pedagogy.models import UV, UVComment
|
||||||
|
|
||||||
|
|
||||||
class UVForm(forms.ModelForm):
|
class UVForm(forms.ModelForm):
|
||||||
@ -68,3 +68,13 @@ class UVForm(forms.ModelForm):
|
|||||||
super(UVForm, self).__init__(*args, **kwargs)
|
super(UVForm, self).__init__(*args, **kwargs)
|
||||||
self.fields["author"].queryset = User.objects.filter(id=author_id).all()
|
self.fields["author"].queryset = User.objects.filter(id=author_id).all()
|
||||||
self.fields["author"].initial = author_id
|
self.fields["author"].initial = author_id
|
||||||
|
|
||||||
|
|
||||||
|
class UVCommentForm(forms.ModelForm):
|
||||||
|
"""
|
||||||
|
Form handeling creation and edit of an UVComment
|
||||||
|
"""
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = UVComment
|
||||||
|
fields = ()
|
||||||
|
13
pedagogy/templates/pedagogy/uv_detail.jinja
Normal file
13
pedagogy/templates/pedagogy/uv_detail.jinja
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% trans %}UV Details{% endtrans %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>{{ object.code }} - {{ object.title }}</h1>
|
||||||
|
<p>{{ object.objectives|markdown }}</p>
|
||||||
|
<p>{{ object.program|markdown }}</p>
|
||||||
|
<p>{{ object.skills|markdown }}</p>
|
||||||
|
<p>{{ object.key_concepts|markdown }}</p>
|
||||||
|
{% endblock %}
|
@ -41,7 +41,7 @@ from core.views import (
|
|||||||
CanEditPropMixin,
|
CanEditPropMixin,
|
||||||
)
|
)
|
||||||
|
|
||||||
from pedagogy.forms import UVForm
|
from pedagogy.forms import UVForm, UVCommentForm
|
||||||
from pedagogy.models import UV
|
from pedagogy.models import UV
|
||||||
|
|
||||||
# Some mixins
|
# Some mixins
|
||||||
@ -71,13 +71,16 @@ class CanCreateUVFunctionMixin(View):
|
|||||||
# Acutal views
|
# Acutal views
|
||||||
|
|
||||||
|
|
||||||
class UVDetailFormView(DetailFormView):
|
class UVDetailFormView(CanViewMixin, CanCreateUVFunctionMixin, DetailFormView):
|
||||||
"""
|
"""
|
||||||
Dispaly every comment of an UV and detailed infos about it
|
Dispaly every comment of an UV and detailed infos about it
|
||||||
Allow to comment the UV
|
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):
|
class UVCommentDetailView(DetailView):
|
||||||
|
Loading…
Reference in New Issue
Block a user