final final final final version (version 1.4)
This commit is contained in:
@@ -76,9 +76,7 @@ networks:
|
|||||||
```
|
```
|
||||||
|
|
||||||
# TODO
|
# 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"
|
- Default value of association "Pagamento effettuato"
|
||||||
- import of storage, computers, courses.
|
- import of storage, computers, courses.
|
||||||
- Tables Sorting with filters
|
- Tables Sorting with filters
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
from logging import disable
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.forms import SelectDateWidget, ModelForm, formset_factory, BaseFormSet
|
from django.forms import SelectDateWidget, ModelForm, formset_factory, BaseFormSet
|
||||||
from .models import Supplier, Bundle, Computer, Accessory, Course, Student, Record, validate_image, StudentViewEditModel, Ticket
|
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):
|
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:
|
class Meta:
|
||||||
model = Computer
|
model = Computer
|
||||||
fields = "__all__"
|
fields = "__all__"
|
||||||
@@ -104,12 +133,13 @@ class ComputerForm(forms.ModelForm):
|
|||||||
"eol_date": "Data di eol",
|
"eol_date": "Data di eol",
|
||||||
"notes": "Note",
|
"notes": "Note",
|
||||||
"cespite": "Cespite",
|
"cespite": "Cespite",
|
||||||
"serial": "Seriale"
|
"serial": "Seriale",
|
||||||
|
"is_deleted": "É cancellato?"
|
||||||
}
|
}
|
||||||
|
|
||||||
class CespiteForm(forms.Form):
|
class CespiteForm(forms.Form):
|
||||||
cespite = forms.CharField(label="Cespite")
|
cespite = forms.CharField(label="Cespite")
|
||||||
seriale = forms.CharField(label="Seriale")
|
serial = forms.CharField(label="Seriale")
|
||||||
|
|
||||||
class AccessoryForm(forms.ModelForm):
|
class AccessoryForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
@@ -123,6 +153,30 @@ class AccessoryForm(forms.ModelForm):
|
|||||||
|
|
||||||
|
|
||||||
class EditAccessoryForm(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:
|
class Meta:
|
||||||
model = Accessory
|
model = Accessory
|
||||||
fields = "__all__"
|
fields = "__all__"
|
||||||
@@ -138,13 +192,6 @@ class EditAccessoryForm(forms.ModelForm):
|
|||||||
"return_motivation": "Motivazione di restituzione",
|
"return_motivation": "Motivazione di restituzione",
|
||||||
"notes": "Note",
|
"notes": "Note",
|
||||||
}
|
}
|
||||||
exclude = [
|
|
||||||
"assignment_date",
|
|
||||||
"assignment_motivation",
|
|
||||||
"return_date",
|
|
||||||
"return_motivation"
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class CSVUpdateForm(forms.Form):
|
class CSVUpdateForm(forms.Form):
|
||||||
file = forms.FileField(label="Seleziona un file CSV")
|
file = forms.FileField(label="Seleziona un file CSV")
|
||||||
@@ -165,7 +212,6 @@ class CourseForm(forms.ModelForm):
|
|||||||
|
|
||||||
|
|
||||||
class ResignationForm(forms.ModelForm):
|
class ResignationForm(forms.ModelForm):
|
||||||
|
|
||||||
resignation_date = forms.DateField(widget=SelectDateWidget(), label="Data di Dimissioni:", initial=datetime.now().date())
|
resignation_date = forms.DateField(widget=SelectDateWidget(), label="Data di Dimissioni:", initial=datetime.now().date())
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Student
|
model = Student
|
||||||
@@ -173,6 +219,8 @@ class ResignationForm(forms.ModelForm):
|
|||||||
|
|
||||||
|
|
||||||
class StudentForm(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:
|
class Meta:
|
||||||
model = Student
|
model = Student
|
||||||
fields= "__all__"
|
fields= "__all__"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<p>{{ err_str }}</p>
|
<p>{{ err_str }}</p>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% 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 %}
|
{% csrf_token %}
|
||||||
<div class="form-content width-100">
|
<div class="form-content width-100">
|
||||||
{{ form }}
|
{{ form }}
|
||||||
|
|||||||
@@ -7,7 +7,9 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
|
{% if bundle.product_type == "Computer" %}
|
||||||
<a href="/import/serials" class="pure-button pure-button-primary add-button">Importa Computer</a>
|
<a href="/import/serials" class="pure-button pure-button-primary add-button">Importa Computer</a>
|
||||||
|
{% endif %}
|
||||||
<div class="detail-content">
|
<div class="detail-content">
|
||||||
<table class="pure-table pure-table-horizontal width-100">
|
<table class="pure-table pure-table-horizontal width-100">
|
||||||
<thead>
|
<thead>
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
<li>Data di Nascita: {{ student.birth_date }}</li>
|
<li>Data di Nascita: {{ student.birth_date }}</li>
|
||||||
<li>Codice Fiscale: {{ student.codice_fiscale }}</li>
|
<li>Codice Fiscale: {{ student.codice_fiscale }}</li>
|
||||||
<li>Sesso: {{ student.gender }}</li>
|
<li>Sesso: {{ student.gender }}</li>
|
||||||
<li>Id Studente Corso: {{ student.id_student_course }}</li>
|
|
||||||
<li>Sigla Corso: {{ student.course_acronym }}</li>
|
<li>Sigla Corso: {{ student.course_acronym }}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
<li>Data di Nascita: {{ student.birth_date }}</li>
|
<li>Data di Nascita: {{ student.birth_date }}</li>
|
||||||
<li>Codice Fiscale: {{ student.codice_fiscale }}</li>
|
<li>Codice Fiscale: {{ student.codice_fiscale }}</li>
|
||||||
<li>Sesso: {{ student.gender }}</li>
|
<li>Sesso: {{ student.gender }}</li>
|
||||||
<li>Id Studente Corso: {{ student.id_student_course }}</li>
|
|
||||||
<li>Sigla Corso: {{ student.course_acronym }}</li>
|
<li>Sigla Corso: {{ student.course_acronym }}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -58,14 +58,14 @@ def import_students(request):
|
|||||||
csv_data = csv_file.read().decode("utf-8").splitlines()
|
csv_data = csv_file.read().decode("utf-8").splitlines()
|
||||||
reader = csv.DictReader(csv_data)
|
reader = csv.DictReader(csv_data)
|
||||||
for row in reader:
|
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")
|
birth_date = datetime.strptime(row["DataNascita"], "%m/%d/%Y")
|
||||||
student = Student()
|
student = Student()
|
||||||
student.codice_fiscale = row["CodiceFiscale"]
|
student.codice_fiscale = row["CodiceFiscale"]
|
||||||
student.course_acronym = row[""]
|
student.course_acronym = row["AcronimoCorso"]
|
||||||
student.last_name = row["Cognome"]
|
student.last_name = row["Cognome"]
|
||||||
student.first_name = row["Nome"]
|
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.phone_number = row["Tel"]
|
||||||
student.municipality_residence = row["ComuneRes"]
|
student.municipality_residence = row["ComuneRes"]
|
||||||
student.province_residence = row["ProvRes"]
|
student.province_residence = row["ProvRes"]
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ def delete_computer(request, id):
|
|||||||
computer.delete()
|
computer.delete()
|
||||||
|
|
||||||
record.date = datetime.now().date()
|
record.date = datetime.now().date()
|
||||||
record.action = "reset"
|
record.action = "delete"
|
||||||
record.product = "computer"
|
record.product = "computer"
|
||||||
record.user = request.user
|
record.user = request.user
|
||||||
record.save()
|
record.save()
|
||||||
@@ -118,8 +118,8 @@ def delete_accessory(request, id):
|
|||||||
accessory.delete()
|
accessory.delete()
|
||||||
|
|
||||||
record.date = datetime.now().date()
|
record.date = datetime.now().date()
|
||||||
record.action = "reset"
|
record.action = "delete"
|
||||||
record.product = "computer"
|
record.product = "accessory"
|
||||||
record.user = request.user
|
record.user = request.user
|
||||||
record.save()
|
record.save()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user