Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

Commit ff577093 authored by grisel-davy's avatar grisel-davy

champ date et disclaimer dans le template

parent 9ed2740c
......@@ -152,3 +152,8 @@ th.long_text{
.table-borderless th {
border: none !important;
}
/* nicer forms */
.form-control {
height: auto;
}
......@@ -334,6 +334,7 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
'email',
'school',
'comment',
'disclaimer',
'room',
'shell',
'telephone',
......
......@@ -238,6 +238,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
default=get_fresh_user_uid,
unique=True
)
disclaimer = models.FileField(upload_to='disclaimers', blank=True)
rezo_rez_uid = models.PositiveIntegerField(
unique=True,
blank=True,
......
......@@ -33,6 +33,27 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block content %}
{% bootstrap_form_errors userform %}
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css" type="text/css">
<script type='text/javascript'>
function submitBday() {
var field = document.getElementById("file");
var Bdate = document.getElementById('bday').value;
var Bday = +new Date(Bdate);
var age = ((Date.now() - Bday) / (31557600000));
if (age < 18){
field.style.display = "block";
}
else{
field.style.display = "none";
}
}
</script>
<form class="form" method="post">
{% csrf_token %}
......@@ -41,7 +62,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="form-row">
<div class="form-group col-md-4">
{{ userform.name.label_tag }}
{% render_field userform.name class="form-control" %}
{% render_field userform.name class="form-control" requiered=True %}
</div>
<div class="form-group col-md-4">
{{ userform.surname.label_tag }}
......@@ -54,16 +75,28 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</div>
<div class="form-row">
<div class="form-group col-md-6">
{{ userform.email.label_tag }}
{% render_field userform.email class="form-control" %}
</div>
<div class="form-group col-md-6">
{{ userform.telephone.label_tag }}
{% render_field userform.telephone class="form-control" %}
</div>
<div class="form-group col-md-4">
{{ userform.email.label_tag }}
{% render_field userform.email class="form-control" %}
</div>
<div class="form-group col-md-4">
{{ userform.telephone.label_tag }}
{% render_field userform.telephone class="form-control" %}
</div>
<div class="form-group col-md-4">
<label>Date de naissance</label>
<input class="form-control" id="bday" name="bday" date-date-format="dd-mm-yy" placeholder="Date de naissance" type="date" onchange="submitBday()">
</div>
</div>
<div class="form-group">
<div id="file" style="display:none;">
{{ userform.disclaimer.label_tag }}
{% render_field userform.disclaimer class="form-control" %}
</div>
</div>
<div class="form-group">
<div class="form-group">
{{ userform.school.label_tag }}
{% render_field userform.school class="form-control" %}
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment