final final final final version (version 1.4)
This commit is contained in:
@@ -76,9 +76,7 @@ networks:
|
||||
```
|
||||
|
||||
# TODO
|
||||
- Una schermata di associazione per corso
|
||||
- lunedí serve un foglio con il codice del corso
|
||||
- Visualizzo l'elenco degli studenti
|
||||
|
||||
- Default value of association "Pagamento effettuato"
|
||||
- import of storage, computers, courses.
|
||||
- Tables Sorting with filters
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
from logging import disable
|
||||
from django import forms
|
||||
from django.forms import SelectDateWidget, ModelForm, formset_factory, BaseFormSet
|
||||
from .models import Supplier, Bundle, Computer, Accessory, Course, Student, Record, validate_image, StudentViewEditModel, Ticket
|
||||
@@ -89,6 +90,34 @@ class SupplierForm(forms.ModelForm):
|
||||
|
||||
|
||||
class ComputerForm(forms.ModelForm):
|
||||
choice = (
|
||||
("assigned", "Assegnato"),
|
||||
("in_stock", "In Magazzino"),
|
||||
("eol", "Eol"),
|
||||
("damaged", "Danneggiato"),
|
||||
("replaced", "Sostituito"),
|
||||
("in_repearing", "In Riparazione"),
|
||||
("disposed", "Smaltito")
|
||||
)
|
||||
choice_motv = (
|
||||
(None, "Seleziona un motivo"),
|
||||
("deposit_paid", "Pagamento Effettuato"),
|
||||
("replacement", "Sostitutivo"),
|
||||
("temporary", "Temporaneo")
|
||||
)
|
||||
choice_retmotv = (
|
||||
(None, "Seleziona un motivo"),
|
||||
("student_resigned", "Studente Dimesso"),
|
||||
("damaged","Danneggato"),
|
||||
("not_necessary", "Non più necessario"),
|
||||
|
||||
)
|
||||
status = forms.ChoiceField(choices=choice, initial = "", label="Status")
|
||||
assignment_date = forms.DateField(widget=SelectDateWidget(), label="Data di assegnazione", required=False)
|
||||
assignment_motivation = forms.ChoiceField(choices=choice_motv, label="Motivazione di assegnazione", required=False)
|
||||
return_date = forms.DateField(widget=SelectDateWidget(), label="Data di restituzione", required=False)
|
||||
return_motivation = forms.ChoiceField(choices=choice_retmotv, label="Motivazione di restituzione", required=False)
|
||||
eol_date = forms.DateField(widget=SelectDateWidget(), label="Data di Eol: ", required= False, disabled=True)
|
||||
class Meta:
|
||||
model = Computer
|
||||
fields = "__all__"
|
||||
@@ -104,12 +133,13 @@ class ComputerForm(forms.ModelForm):
|
||||
"eol_date": "Data di eol",
|
||||
"notes": "Note",
|
||||
"cespite": "Cespite",
|
||||
"serial": "Seriale"
|
||||
"serial": "Seriale",
|
||||
"is_deleted": "É cancellato?"
|
||||
}
|
||||
|
||||
class CespiteForm(forms.Form):
|
||||
cespite = forms.CharField(label="Cespite")
|
||||
seriale = forms.CharField(label="Seriale")
|
||||
serial = forms.CharField(label="Seriale")
|
||||
|
||||
class AccessoryForm(forms.ModelForm):
|
||||
class Meta:
|
||||
@@ -123,6 +153,30 @@ class AccessoryForm(forms.ModelForm):
|
||||
|
||||
|
||||
class EditAccessoryForm(forms.ModelForm):
|
||||
choice= (
|
||||
("assigned", "Assegnato"),
|
||||
("in_stock", "In Magazzino"),
|
||||
("damaged", "Danneggiato"),
|
||||
("replaced", "Sostituito"),
|
||||
("in_repearing", "In Riparazione"),
|
||||
("disposed","Smaltito")
|
||||
)
|
||||
choice_motv = (
|
||||
(None, "Seleziona un motivo"),
|
||||
("needed", "Necessario"),
|
||||
("replacement", "Sostitutivo"),
|
||||
("temporary", "Temporaneo")
|
||||
)
|
||||
choice_retmotv = (
|
||||
(None, "Seleziona un motivo"),
|
||||
("not_necessary", "Non più necessario"),
|
||||
("damaged", "Danneggiato")
|
||||
)
|
||||
status = forms.ChoiceField(choices=choice, initial = "", label="Status")
|
||||
assignment_date = forms.DateField(widget=SelectDateWidget(), label="Data di assegnazione", required=False)
|
||||
assignment_motivation = forms.ChoiceField(choices=choice_motv, label="Motivazione di assegnazione", required=False)
|
||||
return_date = forms.DateField(widget=SelectDateWidget(), label="Data di restituzione", required=False)
|
||||
return_motivation = forms.ChoiceField(choices=choice_retmotv, label="Motivazione di restituzione", required=False)
|
||||
class Meta:
|
||||
model = Accessory
|
||||
fields = "__all__"
|
||||
@@ -138,13 +192,6 @@ class EditAccessoryForm(forms.ModelForm):
|
||||
"return_motivation": "Motivazione di restituzione",
|
||||
"notes": "Note",
|
||||
}
|
||||
exclude = [
|
||||
"assignment_date",
|
||||
"assignment_motivation",
|
||||
"return_date",
|
||||
"return_motivation"
|
||||
]
|
||||
|
||||
|
||||
class CSVUpdateForm(forms.Form):
|
||||
file = forms.FileField(label="Seleziona un file CSV")
|
||||
@@ -165,7 +212,6 @@ class CourseForm(forms.ModelForm):
|
||||
|
||||
|
||||
class ResignationForm(forms.ModelForm):
|
||||
|
||||
resignation_date = forms.DateField(widget=SelectDateWidget(), label="Data di Dimissioni:", initial=datetime.now().date())
|
||||
class Meta:
|
||||
model = Student
|
||||
@@ -173,6 +219,8 @@ class ResignationForm(forms.ModelForm):
|
||||
|
||||
|
||||
class StudentForm(forms.ModelForm):
|
||||
birth_date = forms.DateField(widget=SelectDateWidget(), label="Data di Nascita")
|
||||
resignation_date = forms.DateField(widget=SelectDateWidget(), label="Data di Dimissioni:")
|
||||
class Meta:
|
||||
model = Student
|
||||
fields= "__all__"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<p>{{ err_str }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
<form action="/assignment/computer" method="post" class="pure-form pure-form-2 pure-form-stacked">
|
||||
<form action="/assignment/cespite" method="post" class="pure-form pure-form-2 pure-form-stacked">
|
||||
{% csrf_token %}
|
||||
<div class="form-content width-100">
|
||||
{{ form }}
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
{% load static %}
|
||||
{% block content %}
|
||||
{% if user.is_authenticated %}
|
||||
{% if bundle.product_type == "Computer" %}
|
||||
<a href="/import/serials" class="pure-button pure-button-primary add-button">Importa Computer</a>
|
||||
{% endif %}
|
||||
<div class="detail-content">
|
||||
<table class="pure-table pure-table-horizontal width-100">
|
||||
<thead>
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
<li>Data di Nascita: {{ student.birth_date }}</li>
|
||||
<li>Codice Fiscale: {{ student.codice_fiscale }}</li>
|
||||
<li>Sesso: {{ student.gender }}</li>
|
||||
<li>Id Studente Corso: {{ student.id_student_course }}</li>
|
||||
<li>Sigla Corso: {{ student.course_acronym }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -166,4 +165,4 @@
|
||||
</table>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
<li>Data di Nascita: {{ student.birth_date }}</li>
|
||||
<li>Codice Fiscale: {{ student.codice_fiscale }}</li>
|
||||
<li>Sesso: {{ student.gender }}</li>
|
||||
<li>Id Studente Corso: {{ student.id_student_course }}</li>
|
||||
<li>Sigla Corso: {{ student.course_acronym }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -58,14 +58,14 @@ def import_students(request):
|
||||
csv_data = csv_file.read().decode("utf-8").splitlines()
|
||||
reader = csv.DictReader(csv_data)
|
||||
for row in reader:
|
||||
course = get_object_or_404(Course, course_code=row[""])
|
||||
course = get_object_or_404(Course, course_code=row["CodiceCorso"])
|
||||
birth_date = datetime.strptime(row["DataNascita"], "%m/%d/%Y")
|
||||
student = Student()
|
||||
student.codice_fiscale = row["CodiceFiscale"]
|
||||
student.course_acronym = row[""]
|
||||
student.course_acronym = row["AcronimoCorso"]
|
||||
student.last_name = row["Cognome"]
|
||||
student.first_name = row["Nome"]
|
||||
student.email_user = row["EmailGSuite"]
|
||||
student.email_user = f"{row['Nome'].lower()}.{row['Cognome'].lower()}@stud.itsaltoadriatico.it" if row["EmailGSuite"] == "" else row["EmailGSuite"].lower()
|
||||
student.phone_number = row["Tel"]
|
||||
student.municipality_residence = row["ComuneRes"]
|
||||
student.province_residence = row["ProvRes"]
|
||||
|
||||
@@ -91,7 +91,7 @@ def delete_computer(request, id):
|
||||
computer.delete()
|
||||
|
||||
record.date = datetime.now().date()
|
||||
record.action = "reset"
|
||||
record.action = "delete"
|
||||
record.product = "computer"
|
||||
record.user = request.user
|
||||
record.save()
|
||||
@@ -118,8 +118,8 @@ def delete_accessory(request, id):
|
||||
accessory.delete()
|
||||
|
||||
record.date = datetime.now().date()
|
||||
record.action = "reset"
|
||||
record.product = "computer"
|
||||
record.action = "delete"
|
||||
record.product = "accessory"
|
||||
record.user = request.user
|
||||
record.save()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user