diff --git a/config/__pycache__/settings.cpython-311.pyc b/config/__pycache__/settings.cpython-311.pyc index dadfaa7..6b52506 100644 Binary files a/config/__pycache__/settings.cpython-311.pyc and b/config/__pycache__/settings.cpython-311.pyc differ diff --git a/config/__pycache__/urls.cpython-311.pyc b/config/__pycache__/urls.cpython-311.pyc index 139db10..480daeb 100644 Binary files a/config/__pycache__/urls.cpython-311.pyc and b/config/__pycache__/urls.cpython-311.pyc differ diff --git a/config/settings.py b/config/settings.py index 001b8c8..a7247c1 100644 --- a/config/settings.py +++ b/config/settings.py @@ -141,6 +141,9 @@ USE_TZ = True STATIC_URL = '/static/' STATIC_ROOT = BASE_DIR / 'staticfiles' +MEDIA_URL = '/media/' +MEDIA_ROOT = BASE_DIR / 'media' + STATICFILES_DIRS = [ BASE_DIR / 'static', diff --git a/config/urls.py b/config/urls.py index 5093d47..d60536e 100644 --- a/config/urls.py +++ b/config/urls.py @@ -15,9 +15,14 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import include, path +from django.urls import path, include +from django.conf import settings +from django.conf.urls.static import static urlpatterns = [ - path("admin/", admin.site.urls), path("", include("core.urls")), + path("admin/", admin.site.urls), ] + +if settings.DEBUG: + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index cd6f855..2bd112a 100644 Binary files a/core/__pycache__/admin.cpython-311.pyc and b/core/__pycache__/admin.cpython-311.pyc differ diff --git a/core/__pycache__/forms.cpython-311.pyc b/core/__pycache__/forms.cpython-311.pyc new file mode 100644 index 0000000..56356eb Binary files /dev/null and b/core/__pycache__/forms.cpython-311.pyc differ diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index 9aa598b..2d874a7 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index 1f807fa..e9609bd 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 6867ddf..4b92fcd 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/admin.py b/core/admin.py index 8c38f3f..3ebea38 100644 --- a/core/admin.py +++ b/core/admin.py @@ -1,3 +1,7 @@ from django.contrib import admin +from .models import Cliente, Portafoglio, Attivita, Documento -# Register your models here. +admin.site.register(Cliente) +admin.site.register(Portafoglio) +admin.site.register(Attivita) +admin.site.register(Documento) diff --git a/core/forms.py b/core/forms.py new file mode 100644 index 0000000..199bcaf --- /dev/null +++ b/core/forms.py @@ -0,0 +1,38 @@ +from django import forms +from .models import Cliente, Portafoglio, Attivita, Documento + +class ClienteForm(forms.ModelForm): + class Meta: + model = Cliente + exclude = ('Importo_Portafoglio_Attuale',) + widgets = { + 'Data_di_Nascita': forms.DateInput(attrs={'type': 'date'}), + } + +class PortafoglioForm(forms.ModelForm): + class Meta: + model = Portafoglio + fields = '__all__' + widgets = { + 'Data_Inizio': forms.DateInput(attrs={'type': 'date'}), + 'cliente': forms.HiddenInput(), + } + +class AttivitaForm(forms.ModelForm): + class Meta: + model = Attivita + fields = '__all__' + widgets = { + 'Data': forms.DateInput(attrs={'type': 'date'}), + 'Ora': forms.TimeInput(attrs={'type': 'time'}), + 'cliente': forms.HiddenInput(), + } + +class DocumentoForm(forms.ModelForm): + class Meta: + model = Documento + fields = '__all__' + widgets = { + 'Data_di_Scadenza': forms.DateInput(attrs={'type': 'date'}), + 'cliente': forms.HiddenInput(), + } diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py new file mode 100644 index 0000000..c852421 --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,32 @@ +# Generated by Django 5.2.7 on 2025-10-25 16:24 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Cliente', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('Nome', models.CharField(max_length=100)), + ('Cognome', models.CharField(max_length=100)), + ('Codice_Fiscale', models.CharField(max_length=16, unique=True)), + ('Email', models.EmailField(max_length=254)), + ('Telefono', models.CharField(max_length=20)), + ('Data_di_Nascita', models.DateField()), + ('Lavoro', models.CharField(max_length=100)), + ('Stato', models.CharField(choices=[('Cliente', 'Cliente'), ('Prospect', 'Prospect'), ('Ex-Cliente', 'Ex-Cliente')], max_length=20)), + ('Categoria', models.CharField(choices=[('Privato', 'Privato'), ('Azienda', 'Azienda')], max_length=20)), + ('Importo_Portafoglio_Attuale', models.DecimalField(decimal_places=2, default=0.0, editable=False, max_digits=15)), + ('Scadenza_MIFID', models.DateField()), + ('Scadenza_Documento_Identita', models.DateField()), + ], + ), + ] diff --git a/core/migrations/0002_remove_cliente_scadenza_documento_identita_and_more.py b/core/migrations/0002_remove_cliente_scadenza_documento_identita_and_more.py new file mode 100644 index 0000000..2af4967 --- /dev/null +++ b/core/migrations/0002_remove_cliente_scadenza_documento_identita_and_more.py @@ -0,0 +1,61 @@ +# Generated by Django 5.2.7 on 2025-10-25 16:52 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0001_initial'), + ] + + operations = [ + migrations.RemoveField( + model_name='cliente', + name='Scadenza_Documento_Identita', + ), + migrations.RemoveField( + model_name='cliente', + name='Scadenza_MIFID', + ), + migrations.CreateModel( + name='Attivita', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('Data', models.DateField()), + ('Ora', models.TimeField(blank=True, null=True)), + ('Tipo', models.CharField(choices=[('Chiamata', 'Chiamata'), ('Riunione', 'Riunione'), ('Email', 'Email'), ('To-Do', 'To-Do'), ('Avviso Cedola', 'Avviso Cedola'), ('Scadenza Obbligazione', 'Scadenza Obbligazione'), ('Revisione Annuale', 'Revisione Annuale')], max_length=30)), + ('Stato', models.CharField(choices=[('Pianificato', 'Pianificato'), ('Completato', 'Completato')], default='Pianificato', max_length=20)), + ('Note', models.TextField(blank=True, null=True)), + ('cliente', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attivita', to='core.cliente')), + ], + ), + migrations.CreateModel( + name='Documento', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('Nome_Documento', models.CharField(max_length=100)), + ('Tipo', models.CharField(choices=[('Contratto', 'Contratto'), ('KYC', 'KYC'), ('Report', 'Report'), ('Altro', 'Altro')], max_length=20)), + ('Data_Caricamento', models.DateField(auto_now_add=True)), + ('Data_di_Scadenza', models.DateField(blank=True, null=True)), + ('File', models.FileField(upload_to='documenti/')), + ('Condivisibile', models.BooleanField(default=False)), + ('cliente', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='documenti', to='core.cliente')), + ], + ), + migrations.CreateModel( + name='Portafoglio', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('Nome_Portafoglio', models.CharField(max_length=100)), + ('Profilo_di_Rischio', models.CharField(choices=[('Conservativo', 'Conservativo'), ('Bilanciato', 'Bilanciato'), ('Aggressivo', 'Aggressivo')], max_length=20)), + ('Composizione_Asset_Allocation', models.TextField(blank=True, null=True)), + ('Data_Inizio', models.DateField()), + ('Valore_Iniziale', models.DecimalField(decimal_places=2, max_digits=15)), + ('Valore_Corrente', models.DecimalField(decimal_places=2, max_digits=15)), + ('Note', models.TextField(blank=True, null=True)), + ('cliente', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='portafogli', to='core.cliente')), + ], + ), + ] diff --git a/core/migrations/__pycache__/0001_initial.cpython-311.pyc b/core/migrations/__pycache__/0001_initial.cpython-311.pyc new file mode 100644 index 0000000..92357d7 Binary files /dev/null and b/core/migrations/__pycache__/0001_initial.cpython-311.pyc differ diff --git a/core/migrations/__pycache__/0002_remove_cliente_scadenza_documento_identita_and_more.cpython-311.pyc b/core/migrations/__pycache__/0002_remove_cliente_scadenza_documento_identita_and_more.cpython-311.pyc new file mode 100644 index 0000000..446d7cc Binary files /dev/null and b/core/migrations/__pycache__/0002_remove_cliente_scadenza_documento_identita_and_more.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 71a8362..69ef07e 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,86 @@ from django.db import models -# Create your models here. +class Cliente(models.Model): + STATO_CHOICES = [ + ('Cliente', 'Cliente'), + ('Prospect', 'Prospect'), + ('Ex-Cliente', 'Ex-Cliente'), + ] + CATEGORIA_CHOICES = [ + ('Privato', 'Privato'), + ('Azienda', 'Azienda'), + ] + + Nome = models.CharField(max_length=100) + Cognome = models.CharField(max_length=100) + Codice_Fiscale = models.CharField(max_length=16, unique=True) + Email = models.EmailField() + Telefono = models.CharField(max_length=20) + Data_di_Nascita = models.DateField() + Lavoro = models.CharField(max_length=100) + Stato = models.CharField(max_length=20, choices=STATO_CHOICES) + Categoria = models.CharField(max_length=20, choices=CATEGORIA_CHOICES) + Importo_Portafoglio_Attuale = models.DecimalField(max_digits=15, decimal_places=2, default=0.00, editable=False) + + def __str__(self): + return f"{self.Nome} {self.Cognome}" + +class Portafoglio(models.Model): + PROFILO_RISCHIO_CHOICES = [ + ('Conservativo', 'Conservativo'), + ('Bilanciato', 'Bilanciato'), + ('Aggressivo', 'Aggressivo'), + ] + cliente = models.ForeignKey(Cliente, on_delete=models.CASCADE, related_name='portafogli') + Nome_Portafoglio = models.CharField(max_length=100) + Profilo_di_Rischio = models.CharField(max_length=20, choices=PROFILO_RISCHIO_CHOICES) + Composizione_Asset_Allocation = models.TextField(blank=True, null=True) + Data_Inizio = models.DateField() + Valore_Iniziale = models.DecimalField(max_digits=15, decimal_places=2) + Valore_Corrente = models.DecimalField(max_digits=15, decimal_places=2) + Note = models.TextField(blank=True, null=True) + + def __str__(self): + return f"{self.Nome_Portafoglio} ({self.cliente})" + +class Attivita(models.Model): + TIPO_CHOICES = [ + ('Chiamata', 'Chiamata'), + ('Riunione', 'Riunione'), + ('Email', 'Email'), + ('To-Do', 'To-Do'), + ('Avviso Cedola', 'Avviso Cedola'), + ('Scadenza Obbligazione', 'Scadenza Obbligazione'), + ('Revisione Annuale', 'Revisione Annuale'), + ] + STATO_CHOICES = [ + ('Pianificato', 'Pianificato'), + ('Completato', 'Completato'), + ] + cliente = models.ForeignKey(Cliente, on_delete=models.CASCADE, related_name='attivita') + Data = models.DateField() + Ora = models.TimeField(blank=True, null=True) + Tipo = models.CharField(max_length=30, choices=TIPO_CHOICES) + Stato = models.CharField(max_length=20, choices=STATO_CHOICES, default='Pianificato') + Note = models.TextField(blank=True, null=True) + + def __str__(self): + return f"{self.Tipo} - {self.Data} - {self.cliente}" + +class Documento(models.Model): + TIPO_CHOICES = [ + ('Contratto', 'Contratto'), + ('KYC', 'KYC'), + ('Report', 'Report'), + ('Altro', 'Altro'), + ] + cliente = models.ForeignKey(Cliente, on_delete=models.CASCADE, related_name='documenti') + Nome_Documento = models.CharField(max_length=100) + Tipo = models.CharField(max_length=20, choices=TIPO_CHOICES) + Data_Caricamento = models.DateField(auto_now_add=True) + Data_di_Scadenza = models.DateField(blank=True, null=True) + File = models.FileField(upload_to='documenti/') # Placeholder, will be configured for S3 + Condivisibile = models.BooleanField(default=False) + + def __str__(self): + return f"{self.Nome_Documento} ({self.cliente})" \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index 788576e..2e81fe0 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -6,6 +6,30 @@ {% block head %}{% endblock %}
- {% block content %}{% endblock %} + + +