minor fixes
This commit is contained in:
@@ -2,6 +2,5 @@
|
|||||||
.venv
|
.venv
|
||||||
.gitignore
|
.gitignore
|
||||||
*.env
|
*.env
|
||||||
*.sqlite3
|
|
||||||
docker-compose.yaml
|
docker-compose.yaml
|
||||||
dockerfile
|
dockerfile
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ class SupplierForm(forms.ModelForm):
|
|||||||
"partita_iva": "Partita IVA",
|
"partita_iva": "Partita IVA",
|
||||||
"codice_societa": "Codice Società"
|
"codice_societa": "Codice Società"
|
||||||
}
|
}
|
||||||
|
exclude = ["is_deleted"]
|
||||||
|
|
||||||
|
|
||||||
class ComputerForm(forms.ModelForm):
|
class ComputerForm(forms.ModelForm):
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# Generated by Django 4.2.16 on 2024-09-15 21:34
|
# Generated by Django 4.2.16 on 2024-10-18 10:46
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
import gestionale.models
|
import gestionale.models
|
||||||
@@ -10,6 +11,7 @@ class Migration(migrations.Migration):
|
|||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
@@ -57,25 +59,6 @@ class Migration(migrations.Migration):
|
|||||||
('prev_product_detail', models.TextField(null=True)),
|
('prev_product_detail', models.TextField(null=True)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
|
||||||
name='StudentViewEditModel',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('profile_image', models.ImageField(blank=True, null=True, upload_to='profile_pictures/', validators=[gestionale.models.validate_image])),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Supplier',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('supplier_name', models.CharField(max_length=255)),
|
|
||||||
('supplier_address', models.CharField(max_length=255)),
|
|
||||||
('supplier_phone', models.CharField(max_length=255)),
|
|
||||||
('supplier_email', models.EmailField(max_length=255)),
|
|
||||||
('partita_iva', models.CharField(max_length=255)),
|
|
||||||
('codice_societa', models.CharField(max_length=255)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Student',
|
name='Student',
|
||||||
fields=[
|
fields=[
|
||||||
@@ -100,6 +83,38 @@ class Migration(migrations.Migration):
|
|||||||
('course_id', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='students', to='gestionale.course')),
|
('course_id', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='students', to='gestionale.course')),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='StudentViewEditModel',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('profile_image', models.ImageField(blank=True, null=True, upload_to='profile_pictures/', validators=[gestionale.models.validate_image])),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Supplier',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('supplier_name', models.CharField(max_length=255)),
|
||||||
|
('supplier_address', models.CharField(max_length=255)),
|
||||||
|
('supplier_phone', models.CharField(max_length=255)),
|
||||||
|
('supplier_email', models.EmailField(max_length=255)),
|
||||||
|
('partita_iva', models.CharField(max_length=255)),
|
||||||
|
('codice_societa', models.CharField(max_length=255)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Ticket',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('title', models.CharField(max_length=255)),
|
||||||
|
('content', models.TextField()),
|
||||||
|
('submit_date', models.DateField()),
|
||||||
|
('closing_date', models.DateField(blank=True, null=True)),
|
||||||
|
('is_closed', models.BooleanField(default=False)),
|
||||||
|
('id_student', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='gestionale.student')),
|
||||||
|
('id_user_in_charge', models.ForeignKey(blank=True, limit_choices_to={'is_staff': True}, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Computer',
|
name='Computer',
|
||||||
fields=[
|
fields=[
|
||||||
@@ -114,6 +129,7 @@ class Migration(migrations.Migration):
|
|||||||
('notes', models.CharField(blank=True, max_length=255, null=True)),
|
('notes', models.CharField(blank=True, max_length=255, null=True)),
|
||||||
('cespite', models.CharField(blank=True, max_length=255, null=True)),
|
('cespite', models.CharField(blank=True, max_length=255, null=True)),
|
||||||
('serial', models.CharField(max_length=255, unique=True)),
|
('serial', models.CharField(max_length=255, unique=True)),
|
||||||
|
('is_deleted', models.BooleanField(default=False)),
|
||||||
('id_bundle', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='bundles', to='gestionale.bundle')),
|
('id_bundle', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='bundles', to='gestionale.bundle')),
|
||||||
('id_student', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='gestionale.student')),
|
('id_student', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='gestionale.student')),
|
||||||
],
|
],
|
||||||
@@ -135,6 +151,7 @@ class Migration(migrations.Migration):
|
|||||||
('return_date', models.DateField(blank=True, null=True)),
|
('return_date', models.DateField(blank=True, null=True)),
|
||||||
('return_motivation', models.CharField(blank=True, max_length=255, null=True)),
|
('return_motivation', models.CharField(blank=True, max_length=255, null=True)),
|
||||||
('notes', models.CharField(blank=True, max_length=255, null=True)),
|
('notes', models.CharField(blank=True, max_length=255, null=True)),
|
||||||
|
('is_deleted', models.BooleanField(default=False)),
|
||||||
('id_bundle', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='bundles_accessory', to='gestionale.bundle')),
|
('id_bundle', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='bundles_accessory', to='gestionale.bundle')),
|
||||||
('id_student', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='gestionale.student')),
|
('id_student', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='gestionale.student')),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Generated by Django 4.2.16 on 2024-10-17 09:18
|
# Generated by Django 4.2.16 on 2024-10-18 12:32
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
@@ -6,12 +6,12 @@ from django.db import migrations, models
|
|||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('gestionale', '0007_accessory_is_deleted_computer_is_deleted'),
|
('gestionale', '0001_initial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AddField(
|
||||||
model_name='bundle',
|
model_name='supplier',
|
||||||
name='is_deleted',
|
name='is_deleted',
|
||||||
field=models.BooleanField(default=False),
|
field=models.BooleanField(default=False),
|
||||||
),
|
),
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
# Generated by Django 4.2.16 on 2024-10-02 15:25
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('gestionale', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Ticket',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('title', models.TextField()),
|
|
||||||
('content', models.TextField()),
|
|
||||||
('submit_date', models.DateField()),
|
|
||||||
('is_closed', models.BooleanField(default=False)),
|
|
||||||
('id_student', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='gestionale.student')),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
# Generated by Django 4.2.16 on 2024-10-02 19:42
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('gestionale', '0002_ticket'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='ticket',
|
|
||||||
name='closing_date',
|
|
||||||
field=models.DateField(blank=True, null=True),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
# Generated by Django 4.2.16 on 2024-10-07 19:45
|
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
||||||
('gestionale', '0003_ticket_closing_date'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='ticket',
|
|
||||||
name='id_user_in_charge',
|
|
||||||
field=models.ForeignKey(blank=True, limit_choices_to={'is_staff': True}, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='ticket',
|
|
||||||
name='title',
|
|
||||||
field=models.CharField(max_length=255),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
# Generated by Django 4.2.16 on 2024-10-09 14:10
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('gestionale', '0004_ticket_id_user_in_charge_alter_ticket_title'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='record',
|
|
||||||
name='prev_product_detail',
|
|
||||||
field=models.TextField(null=True),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='record',
|
|
||||||
name='product_detail',
|
|
||||||
field=models.TextField(null=True),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
# Generated by Django 4.2.16 on 2024-10-17 08:45
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('gestionale', '0005_alter_record_prev_product_detail_and_more'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='bundle',
|
|
||||||
name='is_deleted',
|
|
||||||
field=models.BooleanField(default=False, null=True),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
# Generated by Django 4.2.16 on 2024-10-17 08:48
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('gestionale', '0006_alter_bundle_is_deleted'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='accessory',
|
|
||||||
name='is_deleted',
|
|
||||||
field=models.BooleanField(default=False),
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='computer',
|
|
||||||
name='is_deleted',
|
|
||||||
field=models.BooleanField(default=False),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -25,6 +25,7 @@ class Supplier(models.Model):
|
|||||||
supplier_email = models.EmailField(max_length=255)
|
supplier_email = models.EmailField(max_length=255)
|
||||||
partita_iva = models.CharField(max_length=255)
|
partita_iva = models.CharField(max_length=255)
|
||||||
codice_societa = models.CharField(max_length=255)
|
codice_societa = models.CharField(max_length=255)
|
||||||
|
is_deleted = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<div class="delete-reset-card">
|
<div class="delete-reset-card">
|
||||||
<div>
|
<div>
|
||||||
<h3>Sei sicuro di cancellare il corso {{ id }}?</h3>
|
<h3>Sei sicuro di cancellare il corso {{ id }}?</h3>
|
||||||
<form method="post" action="/delete/corso/{{ id }}">
|
<form method="post" action="/delete/course/{{ id }}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="form-buttons">
|
<div class="form-buttons">
|
||||||
<button type="submit" class="pure-button button-warning">Si</button>
|
<button type="submit" class="pure-button button-warning">Si</button>
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ def delete_supplier(request, id):
|
|||||||
record = Record()
|
record = Record()
|
||||||
supplier_copy= copy.deepcopy(supplier)
|
supplier_copy= copy.deepcopy(supplier)
|
||||||
record.prev_product_detail = supplier_copy
|
record.prev_product_detail = supplier_copy
|
||||||
supplier.delete()
|
supplier.is_deleted = True
|
||||||
|
|
||||||
record.date = datetime.now().date()
|
record.date = datetime.now().date()
|
||||||
record.action = "reset"
|
record.action = "reset"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ def storage(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 suppliers(request):
|
def suppliers(request):
|
||||||
suppliers = Supplier.objects.all()
|
suppliers = Supplier.objects.filter(is_deleted = False)
|
||||||
if request.method == "GET":
|
if request.method == "GET":
|
||||||
return render(request, "gestionale/list/suppliers.html", {
|
return render(request, "gestionale/list/suppliers.html", {
|
||||||
"suppliers": suppliers
|
"suppliers": suppliers
|
||||||
|
|||||||
Reference in New Issue
Block a user