One or more attendees can be given an *offer* from the waitlist. This
offer is given an expiry time, giving the chance to sign up before
-that time. The length of the offer is usually adapted to how much time
-is left until the conference -- to make sure that if the attendee
-doesn't take the offer, there is enough time to give it to somebody
-else. The system does *not* take things like office hours into account
-when calculating the offer time, that has to be done manually.
+that time. The expiry time can either be given as number of hours from
+the current time or as an explicit point in time, depending on which
+field/button combination is used. The length of the offer is usually
+adapted to how much time is left until the conference -- to make sure
+that if the attendee doesn't take the offer, there is enough time to
+give it to somebody else. The system does *not* take things like
+office hours into account when calculating the offer time, that has to
+be done manually (and usually using the make offer until specific
+point in time button).
Offers should always be given from the top of the waitlist. This will
make sure that those who signed up early gets a chance first. The
div.backenddocs dd {
margin-left: 2em;
}
+
+table.borderless tr td,
+table.borderless tr th {
+ border: none;
+}
from postgresqleu.countries.models import Country
-from datetime import datetime, date
+from datetime import datetime, date, timedelta
import requests
class WaitlistOfferForm(forms.Form):
hours = forms.IntegerField(min_value=1, max_value=240, label='Offer valid for (hours)', initial=48)
+ until = forms.DateTimeField(label='Offer valid until', initial=(datetime.now() + timedelta(hours=48)).strftime('%Y-%m-%d %H:%M'))
confirm = forms.BooleanField(help_text='Confirm')
def __init__(self, *args, **kwargs):
super(WaitlistOfferForm, self).__init__(*args, **kwargs)
- if self.data and self.data.has_key('hours'):
+ if self.data:
self.reg_list = self._get_id_list_from_data()
self.fields['confirm'].help_text = "Confirm that you want to send an offer to {0} attendees on the waitlist".format(len(self.reg_list))
+ if self.data.get('submit') == 'Make offer for hours':
+ del self.fields['until']
+ else:
+ del self.fields['hours']
else:
del self.fields['confirm']
if wl.offeredon:
raise Exception("One or more already offered!")
wl.offeredon = datetime.now()
- wl.offerexpires = datetime.now() + timedelta(hours=form.cleaned_data['hours'])
+ if request.POST.get('submit') == 'Make offer for hours':
+ wl.offerexpires = datetime.now() + timedelta(hours=form.cleaned_data['hours'])
+ RegistrationWaitlistHistory(waitlist=wl,
+ text="Made offer valid for {0} hours by {1}".format(form.cleaned_data['hours'], request.user.username)).save()
+ else:
+ wl.offerexpires = form.cleaned_data['until']
+ RegistrationWaitlistHistory(waitlist=wl,
+ text="Made offer valid until {0} by {1}".format(form.cleaned_data['until'], request.user.username)).save()
wl.save()
- RegistrationWaitlistHistory(waitlist=wl,
- text="Made offer valid for {0} hours by {1}".format(form.cleaned_data['hours'], request.user.username)).save()
send_template_mail(conference.contactaddr,
r.email,
"Your waitlisted registration for {0}".format(conference.conferencename),
{%include "confreg/admin_waitlist_list.inc.html"%}
{%endwith%}
-<table>
-{{form}}
+<table class="table borderless">
+ <tr>
+{%if form.hours%}
+ <td class="col-md-3">{{form.hours.label}}</td>
+ <td class="col-md-3">{{form.hours}}</td>
+{%else%}
+ <td colspan="2" class="col-md-6"></td>
+{%endif%}
+{%if form.until%}
+ <td class="col-md-3">{{form.until.label}}</td>
+ <td class="col-md-3">{{form.until}}</td>
+{%else%}
+ <td colspan="2" class="col-md-6"></td>
+{%endif%}
+ </tr>
+{%if form.confirm%}
+ <tr>
+ <td colspan="4" class="col-md-12 warning">{{form.confirm}} {{form.confirm.help_text}}</td>
+ </tr>
+{%endif%}
+ <tr>
+ <td colspan="2" class="col-md-6">
+{%if form.hours%}
+ <input type="submit" name="submit" value="Make offer for hours" class="btn btn-default">
+{%else%}
+ </td>
+{%endif%}
+ <td colspan="2" class="col-md-6">
+{%if form.until%}
+ <input type="submit" name="submit" value="Make offer until" class="btn btn-default"></td>
+{%else%}
+ </td>
+{%endif%}
+ </tr>
+{%if form.confirm%}
+ <tr>
+ <td colspan="4" class="col-md-12">
+ <a href="." class="btn btn-default btn-block">Cancel</a>
+ </td>
+ </tr>
+{%endif%}
+
</table>
-<input type="submit" value="Make offer">
</form>
<h3>Processed waitlist</h3>