diff --git a/GestionaleITS/gestionale/forms.py b/GestionaleITS/gestionale/forms.py index 4c2c992..2ad975b 100644 --- a/GestionaleITS/gestionale/forms.py +++ b/GestionaleITS/gestionale/forms.py @@ -16,12 +16,11 @@ class BundleForm(forms.ModelForm): ("Accessory", "Accessorio"), ("Computer", "Computer") ) - product_type = forms.ChoiceField(choices=type_choices, initial="") - delivery_date = forms.DateField(widget=SelectDateWidget(), initial=datetime.now().date() ) + product_type = forms.ChoiceField(choices=type_choices, initial="", label= "Tipo prodotto") + delivery_date = forms.DateField(widget=SelectDateWidget(), initial=datetime.now().date(), label="Data di Consegna") class Meta: model = Bundle fields = "__all__" - labels = { "product_type": "Tipo Prodotto", "product_name": "Nome Prodotto", @@ -219,8 +218,14 @@ class ResignationForm(forms.ModelForm): class StudentForm(forms.ModelForm): + choice=( + ("ok","Ok"), + ("resigned", "Dimesso") + ) + birth_date = forms.DateField(widget=SelectDateWidget(), label="Data di Nascita") - resignation_date = forms.DateField(widget=SelectDateWidget(), label="Data di Dimissioni:") + resignation_date = forms.DateField(widget=SelectDateWidget(), required=False, label="Data di Dimissioni:") + student_status = forms.ChoiceField(choices=choice, label="Status Studente") class Meta: model = Student fields= "__all__" @@ -248,7 +253,7 @@ class StudentForm(forms.ModelForm): "nation_birth": "Nazione di Nascita", "course_id": "Corso" } - exclude = ["course_acronym", "course_code", "course_status", "course_year", "course_name"] + exclude = ["course_code", "course_status", "course_year", "course_name"] class AssignmentComputerForm(forms.Form): diff --git a/GestionaleITS/gestionale/templates/gestionale/details/detailsbundle.html b/GestionaleITS/gestionale/templates/gestionale/details/detailsbundle.html index 670ab13..f109d2d 100644 --- a/GestionaleITS/gestionale/templates/gestionale/details/detailsbundle.html +++ b/GestionaleITS/gestionale/templates/gestionale/details/detailsbundle.html @@ -7,10 +7,11 @@ {% load static %} {% block content %} {% if user.is_authenticated %} -{% if bundle.product_type == "Computer" %} -Importa Computer -{% endif %} +
+ {% if bundle.product_type == "Computer" %} + Importa Computer + {% endif %} diff --git a/GestionaleITS/gestionale/templates/gestionale/edit/editstudent.html b/GestionaleITS/gestionale/templates/gestionale/edit/editstudent.html index 76e9bb3..e3217a5 100644 --- a/GestionaleITS/gestionale/templates/gestionale/edit/editstudent.html +++ b/GestionaleITS/gestionale/templates/gestionale/edit/editstudent.html @@ -12,16 +12,16 @@

{{ err_str }}

{% endif %} -

Stai modificando:

+

Stai modificando lo studente {{ id }}:

{% csrf_token %}
{{ form }} -
-
- - -
+ +
+ + +
{% endif %} {% endblock %} diff --git a/GestionaleITS/gestionale/views/views_assignment.py b/GestionaleITS/gestionale/views/views_assignment.py index 6e9a2e7..ff72aac 100644 --- a/GestionaleITS/gestionale/views/views_assignment.py +++ b/GestionaleITS/gestionale/views/views_assignment.py @@ -132,7 +132,7 @@ def assignment_cespite(request): computer = get_object_or_404(Computer, serial=form["serial"]) computer_copy = copy.deepcopy(computer) computer.cespite = form["cespite"] - computer.save + computer.save() record.date = datetime.now().date() record.action = "assignment" diff --git a/GestionaleITS/gestionale/views/views_list.py b/GestionaleITS/gestionale/views/views_list.py index a9a8beb..c9e9889 100644 --- a/GestionaleITS/gestionale/views/views_list.py +++ b/GestionaleITS/gestionale/views/views_list.py @@ -11,7 +11,7 @@ from ..models import Bundle, Supplier, Student, Course, Ticket @user_passes_test(lambda u: u.is_superuser or u.is_staff) def storage(request): - bundles = Bundle.objects.all() + bundles = Bundle.objects.all().order_by("-id") if request.method == "GET": return render(request, "gestionale/list/storage.html", { "bundles": bundles @@ -31,7 +31,7 @@ def suppliers(request): @user_passes_test(lambda u: u.is_superuser or u.is_staff) def students(request): - students = Student.objects.all().order_by("course_acronym") + students = Student.objects.all().order_by("course_id") if request.method == "GET": return render(request, "gestionale/list/students.html", { "students": students