final final final final final version (version 1.5)

This commit is contained in:
2024-10-25 08:59:35 +02:00
parent e27aba1cd1
commit d4fa6b8c6e
5 changed files with 23 additions and 17 deletions

View File

@@ -16,12 +16,11 @@ class BundleForm(forms.ModelForm):
("Accessory", "Accessorio"), ("Accessory", "Accessorio"),
("Computer", "Computer") ("Computer", "Computer")
) )
product_type = forms.ChoiceField(choices=type_choices, initial="") product_type = forms.ChoiceField(choices=type_choices, initial="", label= "Tipo prodotto")
delivery_date = forms.DateField(widget=SelectDateWidget(), initial=datetime.now().date() ) delivery_date = forms.DateField(widget=SelectDateWidget(), initial=datetime.now().date(), label="Data di Consegna")
class Meta: class Meta:
model = Bundle model = Bundle
fields = "__all__" fields = "__all__"
labels = { labels = {
"product_type": "Tipo Prodotto", "product_type": "Tipo Prodotto",
"product_name": "Nome Prodotto", "product_name": "Nome Prodotto",
@@ -219,8 +218,14 @@ class ResignationForm(forms.ModelForm):
class StudentForm(forms.ModelForm): class StudentForm(forms.ModelForm):
choice=(
("ok","Ok"),
("resigned", "Dimesso")
)
birth_date = forms.DateField(widget=SelectDateWidget(), label="Data di Nascita") 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: class Meta:
model = Student model = Student
fields= "__all__" fields= "__all__"
@@ -248,7 +253,7 @@ class StudentForm(forms.ModelForm):
"nation_birth": "Nazione di Nascita", "nation_birth": "Nazione di Nascita",
"course_id": "Corso" "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): class AssignmentComputerForm(forms.Form):

View File

@@ -7,10 +7,11 @@
{% load static %} {% load static %}
{% block content %} {% block content %}
{% if user.is_authenticated %} {% if user.is_authenticated %}
<div class="detail-content">
{% if bundle.product_type == "Computer" %} {% 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 %} {% endif %}
<div class="detail-content">
<table class="pure-table pure-table-horizontal width-100"> <table class="pure-table pure-table-horizontal width-100">
<thead> <thead>
<tr> <tr>

View File

@@ -12,7 +12,7 @@
<p>{{ err_str }}</p> <p>{{ err_str }}</p>
</div> </div>
{% endif %} {% endif %}
<h3>Stai modificando: </h3> <h3>Stai modificando lo studente {{ id }}:</h3>
<form action="/edit/student/{{ id }}" method="post" enctype="multipart/form-data" class="pure-form pure-form-2 pure-form-stacked"> <form action="/edit/student/{{ id }}" method="post" enctype="multipart/form-data" class="pure-form pure-form-2 pure-form-stacked">
{% csrf_token %} {% csrf_token %}
<div class="from-content width-100"> <div class="from-content width-100">

View File

@@ -132,7 +132,7 @@ def assignment_cespite(request):
computer = get_object_or_404(Computer, serial=form["serial"]) computer = get_object_or_404(Computer, serial=form["serial"])
computer_copy = copy.deepcopy(computer) computer_copy = copy.deepcopy(computer)
computer.cespite = form["cespite"] computer.cespite = form["cespite"]
computer.save computer.save()
record.date = datetime.now().date() record.date = datetime.now().date()
record.action = "assignment" record.action = "assignment"

View File

@@ -11,7 +11,7 @@ from ..models import Bundle, Supplier, Student, Course, Ticket
@user_passes_test(lambda u: u.is_superuser or u.is_staff) @user_passes_test(lambda u: u.is_superuser or u.is_staff)
def storage(request): def storage(request):
bundles = Bundle.objects.all() bundles = Bundle.objects.all().order_by("-id")
if request.method == "GET": if request.method == "GET":
return render(request, "gestionale/list/storage.html", { return render(request, "gestionale/list/storage.html", {
"bundles": bundles "bundles": bundles
@@ -31,7 +31,7 @@ def suppliers(request):
@user_passes_test(lambda u: u.is_superuser or u.is_staff) @user_passes_test(lambda u: u.is_superuser or u.is_staff)
def students(request): def students(request):
students = Student.objects.all().order_by("course_acronym") students = Student.objects.all().order_by("course_id")
if request.method == "GET": if request.method == "GET":
return render(request, "gestionale/list/students.html", { return render(request, "gestionale/list/students.html", {
"students": students "students": students