mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-11 04:19:25 +00:00
pedagogy: base for uv comment moderation
This commit is contained in:
@ -27,7 +27,7 @@ from django import forms
|
||||
from core.views.forms import MarkdownInput
|
||||
from core.models import User
|
||||
|
||||
from pedagogy.models import UV, UVComment
|
||||
from pedagogy.models import UV, UVComment, UVCommentReport
|
||||
|
||||
|
||||
class UVForm(forms.ModelForm):
|
||||
@ -100,3 +100,25 @@ class UVCommentForm(forms.ModelForm):
|
||||
self.fields["author"].initial = author_id
|
||||
self.fields["uv"].queryset = UV.objects.filter(id=uv_id).all()
|
||||
self.fields["uv"].initial = uv_id
|
||||
|
||||
|
||||
class UVCommentReportForm(forms.ModelForm):
|
||||
"""
|
||||
Form handeling creation and edit of an UVReport
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
model = UVCommentReport
|
||||
fields = ("comment", "reporter", "reason")
|
||||
widgets = {
|
||||
"comment": forms.HiddenInput,
|
||||
"reporter": forms.HiddenInput,
|
||||
"reason": MarkdownInput,
|
||||
}
|
||||
|
||||
def __init__(self, reporter_id, comment_id, *args, **kwargs):
|
||||
super(UVCommentReportForm, self).__init__(*args, **kwargs)
|
||||
self.fields["reporter"].queryset = User.objects.filter(id=reporter_id).all()
|
||||
self.fields["reporter"].initial = reporter_id
|
||||
self.fields["comment"].queryset = UVComment.objects.filter(id=comment_id).all()
|
||||
self.fields["comment"].initial = comment_id
|
||||
|
Reference in New Issue
Block a user