workshop attendee: modify talk form
This commit is contained in:
parent
5da6a8b711
commit
65a9c49677
|
@ -31,7 +31,7 @@ class TalkForm(forms.ModelForm):
|
|||
|
||||
class Meta:
|
||||
model = Talk
|
||||
fields = ['title', 'abstract', 'description', 'topics', 'track', 'notes', 'event', 'speakers', 'duration', 'start_date', 'room']
|
||||
fields = ['title', 'abstract', 'description', 'topics', 'track', 'notes', 'event', 'speakers', 'duration', 'start_date', 'room', 'registration_required', 'attendees_limit']
|
||||
widgets = {'topics': forms.CheckboxSelectMultiple(), 'speakers': Select2TagWidget()}
|
||||
help_texts = {
|
||||
'abstract': _('Should be less than 255 characters'),
|
||||
|
|
|
@ -200,7 +200,7 @@ class Talk(PonyConfModel):
|
|||
return None
|
||||
|
||||
@property
|
||||
def remaining_attendee(self):
|
||||
def remaining_attendees(self):
|
||||
if self.registration_required and self.attendees_limit:
|
||||
return self.attendees_limit - self.attendees.count()
|
||||
else:
|
||||
|
|
|
@ -20,4 +20,17 @@
|
|||
{% block js_end %}
|
||||
{{ block.super }}
|
||||
{{ form.media.js }}
|
||||
<script type="text/javascript">
|
||||
var update_attendees_limit = function() {
|
||||
if ($("#id_registration_required").is(":checked")) {
|
||||
$(".form-group:has(#id_attendees_limit)").show();
|
||||
} else {
|
||||
$(".form-group:has(#id_attendees_limit)").hide();
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
update_attendees_limit();
|
||||
$("#id_registration_required").change(update_attendees_limit);
|
||||
})
|
||||
</script>
|
||||
{% endblock js_end %}
|
||||
|
|
Loading…
Reference in New Issue