Skip to content

Commit

Permalink
proposals.disabled.after not be required
Browse files Browse the repository at this point in the history
  • Loading branch information
alice6373 committed Jan 16, 2021
1 parent 32f30a1 commit c4ef31e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 39 deletions.
30 changes: 23 additions & 7 deletions src/reviews/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,31 @@ def review_stages(request):
]

if request.method == 'POST':
date_time_obj = date_preprocess(
DATETIME_INPUT_FORMATS, request.POST['proposals.disable.after'])
tz_selectd = pytz.timezone(request.POST['review_timezone'])
loc_dt = tz_selectd.localize(date_time_obj).strftime(
'%Y-%m-%d %H:%M:%S%z')

for tag in review_stages_var:
key = settings.CONFERENCE_DEFAULT_SLUG + '.' + tag
if (tag == 'proposals.disable.after'):
value = loc_dt
if(request.POST['proposals.disable.after'] == ""):
continue
else:
date_time_obj = date_preprocess(
DATETIME_INPUT_FORMATS,
request.POST['proposals.disable.after'])
if(date_time_obj is None):
messages.error(request,'Please input valid date format : " + "%Y-%m-%dT%H:%M')
return render(
request, 'reviews/review_stages.html', {
'timezones': pytz.common_timezones,
'review_stages_list': review_stages_list,
'current_review_stages_setting': current_review_stages_setting,
**reviews_state()._asdict()
})
continue
else:
tz_selectd = pytz.timezone(request.POST['review_timezone'])
loc_dt = tz_selectd.localize(date_time_obj).strftime(
'%Y-%m-%d %H:%M:%S%z')
value = loc_dt
elif (tag == 'reviews.stage'):
value = int(request.POST[tag])
else:
Expand Down Expand Up @@ -356,4 +371,5 @@ def date_preprocess(DATETIME_INPUT_FORMATS, value):
return datetime.datetime.strptime(value, format)
except (ValueError, TypeError):
continue
raise ValidationError("Please input valid date format : " + "%Y-%m-%dT%H:%M")
return None
# raise ValidationError("Please input valid date format : " + "%Y-%m-%dT%H:%M")
3 changes: 2 additions & 1 deletion src/static/js/reviews/review_stages.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,5 @@ $('.hotkey').click(function () {
reviews_stage.value = "0";
reviews_visible_to_submitters.checked = true;
}
});

});
33 changes: 2 additions & 31 deletions src/templates/default/reviews/review_stages.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,12 @@ <h3 class="dashboard-header">
<div class="panel panel-default">
<div class="panel-heading">{% trans 'Current Review Stage Setting' %}</div>
<ul class="list-group">
<li class="panel-body list-group-item">
{{ ".proposals.creatable"|configuration_switch }}
<div class="pull-right">
<p>{{ current_review_stages_setting.proposals_creatable }}</p>
</div>
</li>
<li class="panel-body list-group-item">
{{ ".proposals.editable"|configuration_switch }}
<div class="pull-right">
<p>{{ current_review_stages_setting.proposals_editable }}</p>
</div>
</li>
<li class="panel-body list-group-item">
{{ ".proposals.withdrawable"|configuration_switch }}
<div class="pull-right">
<p>{{ current_review_stages_setting.proposals_withdrawable }}</p>
</div>
</li>
<li class="panel-body list-group-item">
{{ ".proposals.reviews.visible.to.submitters"|configuration_switch }}
<div class="pull-right">
<p>{{ current_review_stages_setting.reviews_visible_to_submitters }}</p>
</div>
</li>
<li class="panel-body list-group-item">
{{ ".proposals.reviews.stage"|configuration_switch }}
<div class="pull-right">
<p>{{ current_review_stages_setting.reviews_stage }}</p>
</div>
</li>
<li class="panel-body list-group-item">
{{ ".proposals.proposals.disable.after"|configuration_switch }}
<div class="pull-right">
<p>{{ current_review_stages_setting.proposals_disable_after }}</p>
</div>
</li>
</ul>
</div>
<!--Hot Key Button-->
Expand Down Expand Up @@ -121,7 +92,7 @@ <h4>{% trans 'Set Review Stage' %}</h4>
{{ ".proposals.disable.after"|configuration_switch }}
<div class="input-customized-size pull-right">
<input name="proposals.disable.after" type="datetime-local" placeholder="YYYY-mm-ddThh:mm"
required="required">
>
</div>
</li>
<li class="panel-title list-group-item">
Expand Down

0 comments on commit c4ef31e

Please sign in to comment.