diff --git a/SciPost_v1/urls.py b/SciPost_v1/urls.py index 11c640116c6bffe41466958b01638c47d83103c9..9de4150622f5359fb55acdd2d0c9da1378d37d9c 100644 --- a/SciPost_v1/urls.py +++ b/SciPost_v1/urls.py @@ -31,6 +31,7 @@ urlpatterns = [ url(r'^submission/', include('submissions.urls', namespace="submissions")), url(r'^theses/', include('theses.urls', namespace="theses")), url(r'^thesis/', include('theses.urls', namespace="theses")), + url(r'^meetings/', include('virtualmeetings.urls', namespace="virtualmeetings")), url(r'^news/', include('news.urls', namespace="news")), ] diff --git a/scipost/forms.py b/scipost/forms.py index 221291d044f77a6a026eb9cbf77e16efc230242e..3a85ac22032944518aae6cb8a7230eee68005bb9 100644 --- a/scipost/forms.py +++ b/scipost/forms.py @@ -316,59 +316,59 @@ class SPBMembershipForm(forms.ModelForm): css_class="row"), ) - -################# -# VGMs, Motions # -################# - -class FeedbackForm(forms.ModelForm): - class Meta: - model = Feedback - fields = ['feedback'] - - -class NominationForm(forms.ModelForm): - class Meta: - model = Nomination - fields = ['first_name', 'last_name', - 'discipline', 'expertises', 'webpage'] - - def __init__(self, *args, **kwargs): - super(NominationForm, self).__init__(*args, **kwargs) - self.fields['expertises'].widget = forms.SelectMultiple(choices=SCIPOST_SUBJECT_AREAS) - - -class MotionForm(forms.ModelForm): - class Meta: - model = Motion - fields = ['category', 'background', 'motion'] - - def __init__(self, *args, **kwargs): - super(MotionForm, self).__init__(*args, **kwargs) - self.fields['background'].label = '' - self.fields['background'].widget.attrs.update( - {'rows': 8, 'cols': 100, - 'placeholder': 'Provide useful background information on your Motion.'}) - self.fields['motion'].label = '' - self.fields['motion'].widget.attrs.update( - {'rows': 8, 'cols': 100, - 'placeholder': 'Phrase your Motion as clearly and succinctly as possible.'}) - self.helper = FormHelper() - self.helper.layout = Layout( - Field('category'), - Div( - Div(HTML('<p>Background:</p>'), - css_class="col-2"), - Div( - Field('background'), - css_class="col-10"), - css_class="row"), - Div( - Div(HTML('<p>Motion:</p>'), - css_class="col-2"), - Div( - Field('motion'), - css_class="col-10"), - css_class="row"), - Submit('submit', 'Submit'), - ) +# +# ################# +# # VGMs, Motions # +# ################# +# +# class FeedbackForm(forms.ModelForm): +# class Meta: +# model = Feedback +# fields = ['feedback'] +# +# +# class NominationForm(forms.ModelForm): +# class Meta: +# model = Nomination +# fields = ['first_name', 'last_name', +# 'discipline', 'expertises', 'webpage'] +# +# def __init__(self, *args, **kwargs): +# super(NominationForm, self).__init__(*args, **kwargs) +# self.fields['expertises'].widget = forms.SelectMultiple(choices=SCIPOST_SUBJECT_AREAS) +# +# +# class MotionForm(forms.ModelForm): +# class Meta: +# model = Motion +# fields = ['category', 'background', 'motion'] +# +# def __init__(self, *args, **kwargs): +# super(MotionForm, self).__init__(*args, **kwargs) +# self.fields['background'].label = '' +# self.fields['background'].widget.attrs.update( +# {'rows': 8, 'cols': 100, +# 'placeholder': 'Provide useful background information on your Motion.'}) +# self.fields['motion'].label = '' +# self.fields['motion'].widget.attrs.update( +# {'rows': 8, 'cols': 100, +# 'placeholder': 'Phrase your Motion as clearly and succinctly as possible.'}) +# self.helper = FormHelper() +# self.helper.layout = Layout( +# Field('category'), +# Div( +# Div(HTML('<p>Background:</p>'), +# css_class="col-2"), +# Div( +# Field('background'), +# css_class="col-10"), +# css_class="row"), +# Div( +# Div(HTML('<p>Motion:</p>'), +# css_class="col-2"), +# Div( +# Field('motion'), +# css_class="col-10"), +# css_class="row"), +# Submit('submit', 'Submit'), +# ) diff --git a/scipost/templates/scipost/VGMs.html b/scipost/templates/scipost/VGMs.html index 493eefde5df67e226514048c5410da811aae0b57..a482a21dfadd11a7121e88458dd9bdb2df7ef9a0 100644 --- a/scipost/templates/scipost/VGMs.html +++ b/scipost/templates/scipost/VGMs.html @@ -16,7 +16,7 @@ <ul> {% for VGM in VGM_list %} - <li><a href="{% url 'scipost:VGM_detail' VGM_id=VGM.id %}">{{ VGM }}</a></li> + <li><a href="{% url 'virtualmeetings:VGM_detail' VGM_id=VGM.id %}">{{ VGM }}</a></li> {% endfor %} </ul> diff --git a/scipost/templates/scipost/personal_page.html b/scipost/templates/scipost/personal_page.html index db22196b3b3298f28044dd091488d76d1c4ee22a..8969b01a8ce301c6bddb8bac6625ce3f8a127410 100644 --- a/scipost/templates/scipost/personal_page.html +++ b/scipost/templates/scipost/personal_page.html @@ -92,7 +92,7 @@ <div class="col-12"> <ul class="personalTabMenu"> <li><a class="TabItem" id="AccountTab">Account</a></li> - {% if 'Editorial Administrators' not in user_groups or 'Advisory Board' not in user_groups or 'Editorial College' not in user_groups or 'Vetting Editors' not in user_groups or 'Ambassadors' not in user_groups or 'Junior Ambassadors' not in user_groups %} + {% if 'Editorial Administrators' in user_groups or 'Advisory Board' in user_groups or 'Editorial College' in user_groups or 'Vetting Editors' in user_groups or 'Ambassadors' in user_groups or 'Junior Ambassadors' in user_groups %} <li><a class="TabItem" id="EdActionTab">Editorial Actions</a></li> {% endif %} <li><a class="TabItem" id="RefereeingTab">Refereeing</a></li> @@ -283,7 +283,7 @@ {% if perms.scipost.can_attend_VGMs %} <h3>Virtual General Meetings</h3> <ul> - <li><a href="{% url 'scipost:VGMs' %}">List of VGMs</a></li> + <li><a href="{% url 'virtualmeetings:VGMs' %}">List of VGMs</a></li> </ul> {% endif %} </div> diff --git a/scipost/urls.py b/scipost/urls.py index 7cafa126b137039a2d813eb721a06ae1041e2299..b3676bef29e6f707220992ef41b46be1508df94f 100644 --- a/scipost/urls.py +++ b/scipost/urls.py @@ -170,28 +170,28 @@ urlpatterns = [ url(r'^Fellow_activity_overview$', views.Fellow_activity_overview, name='Fellow_activity_overview'), - - ############################ - # Virtual General Meetings # - ############################ - url(r'^VGMs$', views.VGMs, name='VGMs'), - url(r'^VGM/(?P<VGM_id>[0-9]+)/$', views.VGM_detail, name='VGM_detail'), - url(r'^feedback/(?P<VGM_id>[0-9]+)$', - views.feedback, name='feedback'), - url(r'^add_remark_on_feedback/(?P<VGM_id>[0-9]+)/(?P<feedback_id>[0-9]+)$', - views.add_remark_on_feedback, name='add_remark_on_feedback'), - url(r'^nominate_Fellow/(?P<VGM_id>[0-9]+)$', - views.nominate_Fellow, name='nominate_Fellow'), - url(r'^add_remark_on_nomination/(?P<VGM_id>[0-9]+)/(?P<nomination_id>[0-9]+)$', - views.add_remark_on_nomination, name='add_remark_on_nomination'), - url(r'^vote_on_nomination/(?P<nomination_id>[0-9]+)/(?P<vote>[AND])$', - views.vote_on_nomination, name='vote_on_nomination'), - url(r'^put_motion_forward/(?P<VGM_id>[0-9]+)$', - views.put_motion_forward, name='put_motion_forward'), - url(r'^add_remark_on_motion/(?P<motion_id>[0-9]+)$', - views.add_remark_on_motion, name='add_remark_on_motion'), - url(r'^vote_on_motion/(?P<motion_id>[0-9]+)/(?P<vote>[AND])$', - views.vote_on_motion, name='vote_on_motion'), + # + # ############################ + # # Virtual General Meetings # + # ############################ + # url(r'^VGMs$', views.VGMs, name='VGMs'), + # url(r'^VGM/(?P<VGM_id>[0-9]+)/$', views.VGM_detail, name='VGM_detail'), + # url(r'^feedback/(?P<VGM_id>[0-9]+)$', + # views.feedback, name='feedback'), + # url(r'^add_remark_on_feedback/(?P<VGM_id>[0-9]+)/(?P<feedback_id>[0-9]+)$', + # views.add_remark_on_feedback, name='add_remark_on_feedback'), + # url(r'^nominate_Fellow/(?P<VGM_id>[0-9]+)$', + # views.nominate_Fellow, name='nominate_Fellow'), + # url(r'^add_remark_on_nomination/(?P<VGM_id>[0-9]+)/(?P<nomination_id>[0-9]+)$', + # views.add_remark_on_nomination, name='add_remark_on_nomination'), + # url(r'^vote_on_nomination/(?P<nomination_id>[0-9]+)/(?P<vote>[AND])$', + # views.vote_on_nomination, name='vote_on_nomination'), + # url(r'^put_motion_forward/(?P<VGM_id>[0-9]+)$', + # views.put_motion_forward, name='put_motion_forward'), + # url(r'^add_remark_on_motion/(?P<motion_id>[0-9]+)$', + # views.add_remark_on_motion, name='add_remark_on_motion'), + # url(r'^vote_on_motion/(?P<motion_id>[0-9]+)/(?P<vote>[AND])$', + # views.vote_on_motion, name='vote_on_motion'), ################ # Publications # diff --git a/scipost/views.py b/scipost/views.py index a82d071eda5cc2477e46b744c43159570f52b506..ce38b21556cf4632be023e2cc23b5315ba31a9e5 100644 --- a/scipost/views.py +++ b/scipost/views.py @@ -10,24 +10,22 @@ from django.contrib.auth import authenticate, login, logout from django.contrib.auth.decorators import login_required from django.contrib.auth.models import Group from django.contrib.auth.views import password_reset, password_reset_confirm -from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist, PermissionDenied +from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist from django.core import mail from django.core.mail import EmailMessage, EmailMultiAlternatives from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.core.urlresolvers import reverse from django.db.models import Q -from django.http import HttpResponseRedirect, JsonResponse +from django.http import HttpResponseRedirect from django.shortcuts import redirect from django.template import Context, Template from django.utils.http import is_safe_url from guardian.decorators import permission_required -from guardian.decorators import permission_required_or_403 -from guardian.shortcuts import assign_perm from .constants import SCIPOST_SUBJECT_AREAS from .models import Contributor, CitationNotification, UnavailabilityPeriod,\ - DraftInvitation, RegistrationInvitation, Remark,\ + DraftInvitation, RegistrationInvitation,\ title_dict, SciPost_from_addresses_dict,\ AuthorshipClaim, SupportingPartner, SPBMembershipAgreement from .forms import AuthenticationForm, DraftInvitationForm, UnavailabilityPeriodForm,\ @@ -35,8 +33,7 @@ from .forms import AuthenticationForm, DraftInvitationForm, UnavailabilityPeriod ModifyPersonalMessageForm, SearchForm, VetRegistrationForm, reg_ref_dict,\ UpdatePersonalDataForm, UpdateUserDataForm, PasswordChangeForm,\ EmailGroupMembersForm, EmailParticularForm, SendPrecookedEmailForm,\ - SupportingPartnerForm, SPBMembershipForm,\ - FeedbackForm, MotionForm, NominationForm, RemarkForm + SupportingPartnerForm, SPBMembershipForm from .utils import Utils, EMAIL_FOOTER, SCIPOST_SUMMARY_FOOTER, SCIPOST_SUMMARY_FOOTER_HTML from commentaries.models import Commentary @@ -50,8 +47,8 @@ from submissions.models import RefereeInvitation, Report, EICRecommendation from submissions.forms import SubmissionSearchForm from theses.models import ThesisLink from theses.forms import ThesisLinkSearchForm -from virtualmeetings.models import VGM, Feedback, Nomination, Motion -from virtualmeetings.constants import motion_categories_dict +# from virtualmeetings.models import VGM, Feedback, Nomination, Motion +# from virtualmeetings.constants import motion_categories_dict ############## @@ -1468,241 +1465,241 @@ def Fellow_activity_overview(request, Fellow_id=None): context['assignments_of_Fellow'] = assignments_of_Fellow return render(request, 'scipost/Fellow_activity_overview.html', context) - -@login_required -@permission_required('scipost.can_attend_VGMs', return_403=True) -def VGMs(request): - VGM_list = VGM.objects.all().order_by('start_date') - context = {'VGM_list': VGM_list} - return render(request, 'scipost/VGMs.html', context) - - -@login_required -@permission_required('scipost.can_attend_VGMs', return_403=True) -def VGM_detail(request, VGM_id): - VGM_instance = get_object_or_404(VGM, id=VGM_id) - VGM_information = Template(VGM_instance.information).render(Context({})) - feedback_received = Feedback.objects.filter(VGM=VGM_instance).order_by('date') - feedback_form = FeedbackForm() - current_Fellows = Contributor.objects.filter( - user__groups__name='Editorial College').order_by('user__last_name') - sent_inv_Fellows = RegistrationInvitation.objects.filter( - invitation_type='F', responded=False) - pending_inv_Fellows = sent_inv_Fellows.filter(declined=False).order_by('last_name') - declined_inv_Fellows = sent_inv_Fellows.filter(declined=True).order_by('last_name') - nomination_form = NominationForm() - nominations = Nomination.objects.filter(accepted=None).order_by('last_name') - motion_form = MotionForm() - remark_form = RemarkForm() - context = { - 'VGM': VGM_instance, - 'VGM_information': VGM_information, - 'feedback_received': feedback_received, - 'feedback_form': feedback_form, - 'current_Fellows': current_Fellows, - 'pending_inv_Fellows': pending_inv_Fellows, - 'declined_inv_Fellows': declined_inv_Fellows, - 'nominations': nominations, - 'nomination_form': nomination_form, - 'motion_categories_dict': motion_categories_dict, - 'motion_form': motion_form, - 'remark_form': remark_form, - } - return render(request, 'scipost/VGM_detail.html', context) - - -@login_required -@permission_required('scipost.can_attend_VGMs', return_403=True) -def feedback(request, VGM_id=None): - if request.method == 'POST': - feedback_form = FeedbackForm(request.POST) - if feedback_form.is_valid(): - feedback = Feedback(by=request.user.contributor, - date=timezone.now().date(), - feedback=feedback_form.cleaned_data['feedback'],) - if VGM_id: - VGM_instance = get_object_or_404(VGM, id=VGM_id) - feedback.VGM = VGM_instance - feedback.save() - ack_message = 'Your feedback has been received.' - context = {'ack_message': ack_message} - if VGM_id: - context['followup_message'] = 'Return to the ' - context['followup_link'] = reverse('scipost:VGM_detail', - kwargs={'VGM_id': VGM_id}) - context['followup_link_label'] = 'VGM page' - return render(request, 'scipost/acknowledgement.html', context) - else: - errormessage = 'The form was not filled properly.' - return render(request, 'scipost/error.html', {'errormessage': errormessage}) - else: - errormessage = 'This view can only be posted to.' - return render(request, 'scipost/error.html', {'errormessage': errormessage}) - - -@login_required -@permission_required('scipost.can_attend_VGMs', raise_exception=True) -def add_remark_on_feedback(request, VGM_id, feedback_id): - # contributor = request.user.contributor - feedback = get_object_or_404(Feedback, pk=feedback_id) - if request.method == 'POST': - remark_form = RemarkForm(request.POST) - if remark_form.is_valid(): - remark = Remark(contributor=request.user.contributor, - feedback=feedback, - date=timezone.now(), - remark=remark_form.cleaned_data['remark']) - remark.save() - return HttpResponseRedirect('/VGM/' + str(VGM_id) + - '/#feedback_id' + str(feedback.id)) - else: - errormessage = 'The form was invalidly filled.' - return render(request, 'scipost/error.html', {'errormessage': errormessage}) - else: - errormessage = 'This view can only be posted to.' - return render(request, 'scipost/error.html', {'errormessage': errormessage}) - - -@login_required -@permission_required('scipost.can_attend_VGMs', return_403=True) -def nominate_Fellow(request, VGM_id): - VGM_instance = get_object_or_404(VGM, id=VGM_id) - if request.method == 'POST': - nomination_form = NominationForm(request.POST) - if nomination_form.is_valid(): - nomination = Nomination( - VGM=VGM_instance, - by=request.user.contributor, - date=timezone.now().date(), - first_name=nomination_form.cleaned_data['first_name'], - last_name=nomination_form.cleaned_data['last_name'], - discipline=nomination_form.cleaned_data['discipline'], - expertises=nomination_form.cleaned_data['expertises'], - webpage=nomination_form.cleaned_data['webpage'], - voting_deadline=VGM_instance.end_date + datetime.timedelta(days=7), - ) - nomination.save() - nomination.update_votes(request.user.contributor.id, 'A') - ack_message = 'The nomination has been registered.' - context = {'ack_message': ack_message, - 'followup_message': 'Return to the ', - 'followup_link': reverse('scipost:VGM_detail', kwargs={'VGM_id': VGM_id}), - 'followup_link_label': 'VGM page'} - return render(request, 'scipost/acknowledgement.html', context) - else: - errormessage = 'The form was not filled properly.' - return render(request, 'scipost/error.html', {'errormessage': errormessage}) - else: - errormessage = 'This view can only be posted to.' - return render(request, 'scipost/error.html', {'errormessage': errormessage}) - - -@login_required -@permission_required('scipost.can_attend_VGMs', raise_exception=True) -def add_remark_on_nomination(request, VGM_id, nomination_id): - # contributor = request.user.contributor - nomination = get_object_or_404(Nomination, pk=nomination_id) - if request.method == 'POST': - remark_form = RemarkForm(request.POST) - if remark_form.is_valid(): - remark = Remark(contributor=request.user.contributor, - nomination=nomination, - date=timezone.now(), - remark=remark_form.cleaned_data['remark']) - remark.save() - return HttpResponseRedirect('/VGM/' + str(VGM_id) + - '/#nomination_id' + str(nomination.id)) - else: - errormessage = 'The form was invalidly filled.' - return render(request, 'scipost/error.html', {'errormessage': errormessage}) - else: - errormessage = 'This view can only be posted to.' - return render(request, 'scipost/error.html', {'errormessage': errormessage}) - - -@login_required -@permission_required('scipost.can_attend_VGMs', raise_exception=True) -def vote_on_nomination(request, nomination_id, vote): - contributor = request.user.contributor - nomination = get_object_or_404(Nomination, pk=nomination_id) - if timezone.now() > nomination.voting_deadline: - errormessage = 'The voting deadline on this nomination has passed.' - return render(request, 'scipost/error.html', {'errormessage': errormessage}) - nomination.update_votes(contributor.id, vote) - return HttpResponseRedirect('/VGM/' + str(nomination.VGM.id) + - '/#nomination_id' + str(nomination.id)) - - -@login_required -@permission_required('scipost.can_attend_VGMs', return_403=True) -def put_motion_forward(request, VGM_id): - VGM_instance = get_object_or_404(VGM, id=VGM_id) - if timezone.now().date() > VGM_instance.end_date: - errormessage = 'This VGM has ended. No new motions can be put forward.' - return render(request, 'scipost/error.html', {'errormessage': errormessage}) - if request.method == 'POST': - motion_form = MotionForm(request.POST) - if motion_form.is_valid(): - motion = Motion( - category=motion_form.cleaned_data['category'], - VGM=VGM_instance, - background=motion_form.cleaned_data['background'], - motion=motion_form.cleaned_data['motion'], - put_forward_by=request.user.contributor, - date=timezone.now().date(), - voting_deadline=VGM_instance.end_date + datetime.timedelta(days=7), - ) - motion.save() - motion.update_votes(request.user.contributor.id, 'A') - ack_message = 'Your motion has been registered.' - context = {'ack_message': ack_message, - 'followup_message': 'Return to the ', - 'followup_link': reverse('scipost:VGM_detail', kwargs={'VGM_id': VGM_id}), - 'followup_link_label': 'VGM page'} - return render(request, 'scipost/acknowledgement.html', context) - else: - errormessage = 'The form was not filled properly.' - return render(request, 'scipost/error.html', {'errormessage': errormessage}) - else: - errormessage = 'This view can only be posted to.' - return render(request, 'scipost/error.html', {'errormessage': errormessage}) - - -@login_required -@permission_required('scipost.can_attend_VGMs', raise_exception=True) -def add_remark_on_motion(request, motion_id): - # contributor = request.user.contributor - motion = get_object_or_404(Motion, pk=motion_id) - if request.method == 'POST': - remark_form = RemarkForm(request.POST) - if remark_form.is_valid(): - remark = Remark(contributor=request.user.contributor, - motion=motion, - date=timezone.now(), - remark=remark_form.cleaned_data['remark']) - remark.save() - return HttpResponseRedirect('/VGM/' + str(motion.VGM.id) + - '/#motion_id' + str(motion.id)) - else: - errormessage = 'The form was invalidly filled.' - return render(request, 'scipost/error.html', {'errormessage': errormessage}) - else: - errormessage = 'This view can only be posted to.' - return render(request, 'scipost/error.html', {'errormessage': errormessage}) - - -@login_required -@permission_required('scipost.can_attend_VGMs', raise_exception=True) -def vote_on_motion(request, motion_id, vote): - contributor = request.user.contributor - motion = get_object_or_404(Motion, pk=motion_id) - if timezone.now() > motion.voting_deadline: - errormessage = 'The voting deadline on this motion has passed.' - return render(request, 'scipost/error.html', {'errormessage': errormessage}) - motion.update_votes(contributor.id, vote) - return HttpResponseRedirect('/VGM/' + str(motion.VGM.id) + - '/#motion_id' + str(motion.id)) - +# +# @login_required +# @permission_required('scipost.can_attend_VGMs', return_403=True) +# def VGMs(request): +# VGM_list = VGM.objects.all().order_by('start_date') +# context = {'VGM_list': VGM_list} +# return render(request, 'scipost/VGMs.html', context) +# +# +# @login_required +# @permission_required('scipost.can_attend_VGMs', return_403=True) +# def VGM_detail(request, VGM_id): +# VGM_instance = get_object_or_404(VGM, id=VGM_id) +# VGM_information = Template(VGM_instance.information).render(Context({})) +# feedback_received = Feedback.objects.filter(VGM=VGM_instance).order_by('date') +# feedback_form = FeedbackForm() +# current_Fellows = Contributor.objects.filter( +# user__groups__name='Editorial College').order_by('user__last_name') +# sent_inv_Fellows = RegistrationInvitation.objects.filter( +# invitation_type='F', responded=False) +# pending_inv_Fellows = sent_inv_Fellows.filter(declined=False).order_by('last_name') +# declined_inv_Fellows = sent_inv_Fellows.filter(declined=True).order_by('last_name') +# nomination_form = NominationForm() +# nominations = Nomination.objects.filter(accepted=None).order_by('last_name') +# motion_form = MotionForm() +# remark_form = RemarkForm() +# context = { +# 'VGM': VGM_instance, +# 'VGM_information': VGM_information, +# 'feedback_received': feedback_received, +# 'feedback_form': feedback_form, +# 'current_Fellows': current_Fellows, +# 'pending_inv_Fellows': pending_inv_Fellows, +# 'declined_inv_Fellows': declined_inv_Fellows, +# 'nominations': nominations, +# 'nomination_form': nomination_form, +# 'motion_categories_dict': motion_categories_dict, +# 'motion_form': motion_form, +# 'remark_form': remark_form, +# } +# return render(request, 'scipost/VGM_detail.html', context) +# +# +# @login_required +# @permission_required('scipost.can_attend_VGMs', return_403=True) +# def feedback(request, VGM_id=None): +# if request.method == 'POST': +# feedback_form = FeedbackForm(request.POST) +# if feedback_form.is_valid(): +# feedback = Feedback(by=request.user.contributor, +# date=timezone.now().date(), +# feedback=feedback_form.cleaned_data['feedback'],) +# if VGM_id: +# VGM_instance = get_object_or_404(VGM, id=VGM_id) +# feedback.VGM = VGM_instance +# feedback.save() +# ack_message = 'Your feedback has been received.' +# context = {'ack_message': ack_message} +# if VGM_id: +# context['followup_message'] = 'Return to the ' +# context['followup_link'] = reverse('scipost:VGM_detail', +# kwargs={'VGM_id': VGM_id}) +# context['followup_link_label'] = 'VGM page' +# return render(request, 'scipost/acknowledgement.html', context) +# else: +# errormessage = 'The form was not filled properly.' +# return render(request, 'scipost/error.html', {'errormessage': errormessage}) +# else: +# errormessage = 'This view can only be posted to.' +# return render(request, 'scipost/error.html', {'errormessage': errormessage}) +# +# +# @login_required +# @permission_required('scipost.can_attend_VGMs', raise_exception=True) +# def add_remark_on_feedback(request, VGM_id, feedback_id): +# # contributor = request.user.contributor +# feedback = get_object_or_404(Feedback, pk=feedback_id) +# if request.method == 'POST': +# remark_form = RemarkForm(request.POST) +# if remark_form.is_valid(): +# remark = Remark(contributor=request.user.contributor, +# feedback=feedback, +# date=timezone.now(), +# remark=remark_form.cleaned_data['remark']) +# remark.save() +# return HttpResponseRedirect('/VGM/' + str(VGM_id) + +# '/#feedback_id' + str(feedback.id)) +# else: +# errormessage = 'The form was invalidly filled.' +# return render(request, 'scipost/error.html', {'errormessage': errormessage}) +# else: +# errormessage = 'This view can only be posted to.' +# return render(request, 'scipost/error.html', {'errormessage': errormessage}) +# +# +# @login_required +# @permission_required('scipost.can_attend_VGMs', return_403=True) +# def nominate_Fellow(request, VGM_id): +# VGM_instance = get_object_or_404(VGM, id=VGM_id) +# if request.method == 'POST': +# nomination_form = NominationForm(request.POST) +# if nomination_form.is_valid(): +# nomination = Nomination( +# VGM=VGM_instance, +# by=request.user.contributor, +# date=timezone.now().date(), +# first_name=nomination_form.cleaned_data['first_name'], +# last_name=nomination_form.cleaned_data['last_name'], +# discipline=nomination_form.cleaned_data['discipline'], +# expertises=nomination_form.cleaned_data['expertises'], +# webpage=nomination_form.cleaned_data['webpage'], +# voting_deadline=VGM_instance.end_date + datetime.timedelta(days=7), +# ) +# nomination.save() +# nomination.update_votes(request.user.contributor.id, 'A') +# ack_message = 'The nomination has been registered.' +# context = {'ack_message': ack_message, +# 'followup_message': 'Return to the ', +# 'followup_link': reverse('scipost:VGM_detail', kwargs={'VGM_id': VGM_id}), +# 'followup_link_label': 'VGM page'} +# return render(request, 'scipost/acknowledgement.html', context) +# else: +# errormessage = 'The form was not filled properly.' +# return render(request, 'scipost/error.html', {'errormessage': errormessage}) +# else: +# errormessage = 'This view can only be posted to.' +# return render(request, 'scipost/error.html', {'errormessage': errormessage}) +# +# +# @login_required +# @permission_required('scipost.can_attend_VGMs', raise_exception=True) +# def add_remark_on_nomination(request, VGM_id, nomination_id): +# # contributor = request.user.contributor +# nomination = get_object_or_404(Nomination, pk=nomination_id) +# if request.method == 'POST': +# remark_form = RemarkForm(request.POST) +# if remark_form.is_valid(): +# remark = Remark(contributor=request.user.contributor, +# nomination=nomination, +# date=timezone.now(), +# remark=remark_form.cleaned_data['remark']) +# remark.save() +# return HttpResponseRedirect('/VGM/' + str(VGM_id) + +# '/#nomination_id' + str(nomination.id)) +# else: +# errormessage = 'The form was invalidly filled.' +# return render(request, 'scipost/error.html', {'errormessage': errormessage}) +# else: +# errormessage = 'This view can only be posted to.' +# return render(request, 'scipost/error.html', {'errormessage': errormessage}) +# +# +# @login_required +# @permission_required('scipost.can_attend_VGMs', raise_exception=True) +# def vote_on_nomination(request, nomination_id, vote): +# contributor = request.user.contributor +# nomination = get_object_or_404(Nomination, pk=nomination_id) +# if timezone.now() > nomination.voting_deadline: +# errormessage = 'The voting deadline on this nomination has passed.' +# return render(request, 'scipost/error.html', {'errormessage': errormessage}) +# nomination.update_votes(contributor.id, vote) +# return HttpResponseRedirect('/VGM/' + str(nomination.VGM.id) + +# '/#nomination_id' + str(nomination.id)) +# +# +# @login_required +# @permission_required('scipost.can_attend_VGMs', return_403=True) +# def put_motion_forward(request, VGM_id): +# VGM_instance = get_object_or_404(VGM, id=VGM_id) +# if timezone.now().date() > VGM_instance.end_date: +# errormessage = 'This VGM has ended. No new motions can be put forward.' +# return render(request, 'scipost/error.html', {'errormessage': errormessage}) +# if request.method == 'POST': +# motion_form = MotionForm(request.POST) +# if motion_form.is_valid(): +# motion = Motion( +# category=motion_form.cleaned_data['category'], +# VGM=VGM_instance, +# background=motion_form.cleaned_data['background'], +# motion=motion_form.cleaned_data['motion'], +# put_forward_by=request.user.contributor, +# date=timezone.now().date(), +# voting_deadline=VGM_instance.end_date + datetime.timedelta(days=7), +# ) +# motion.save() +# motion.update_votes(request.user.contributor.id, 'A') +# ack_message = 'Your motion has been registered.' +# context = {'ack_message': ack_message, +# 'followup_message': 'Return to the ', +# 'followup_link': reverse('scipost:VGM_detail', kwargs={'VGM_id': VGM_id}), +# 'followup_link_label': 'VGM page'} +# return render(request, 'scipost/acknowledgement.html', context) +# else: +# errormessage = 'The form was not filled properly.' +# return render(request, 'scipost/error.html', {'errormessage': errormessage}) +# else: +# errormessage = 'This view can only be posted to.' +# return render(request, 'scipost/error.html', {'errormessage': errormessage}) +# +# +# @login_required +# @permission_required('scipost.can_attend_VGMs', raise_exception=True) +# def add_remark_on_motion(request, motion_id): +# # contributor = request.user.contributor +# motion = get_object_or_404(Motion, pk=motion_id) +# if request.method == 'POST': +# remark_form = RemarkForm(request.POST) +# if remark_form.is_valid(): +# remark = Remark(contributor=request.user.contributor, +# motion=motion, +# date=timezone.now(), +# remark=remark_form.cleaned_data['remark']) +# remark.save() +# return HttpResponseRedirect('/VGM/' + str(motion.VGM.id) + +# '/#motion_id' + str(motion.id)) +# else: +# errormessage = 'The form was invalidly filled.' +# return render(request, 'scipost/error.html', {'errormessage': errormessage}) +# else: +# errormessage = 'This view can only be posted to.' +# return render(request, 'scipost/error.html', {'errormessage': errormessage}) +# +# +# @login_required +# @permission_required('scipost.can_attend_VGMs', raise_exception=True) +# def vote_on_motion(request, motion_id, vote): +# contributor = request.user.contributor +# motion = get_object_or_404(Motion, pk=motion_id) +# if timezone.now() > motion.voting_deadline: +# errormessage = 'The voting deadline on this motion has passed.' +# return render(request, 'scipost/error.html', {'errormessage': errormessage}) +# motion.update_votes(contributor.id, vote) +# return HttpResponseRedirect('/VGM/' + str(motion.VGM.id) + +# '/#motion_id' + str(motion.id)) +# ############################# # Supporting Partners Board # diff --git a/virtualmeetings/urls.py b/virtualmeetings/urls.py index 556a7eb2b1e4dca34f7330c19ab6779aaac8a080..3a83c873c8df2e5747441ea9a6a7c2d00390e4b8 100644 --- a/virtualmeetings/urls.py +++ b/virtualmeetings/urls.py @@ -1,6 +1,4 @@ - -from django.conf.urls import include, url -from django.views.generic import TemplateView +from django.conf.urls import url from . import views