V1
This commit is contained in:
parent
443b2120cb
commit
62acb941dc
Binary file not shown.
Binary file not shown.
@ -141,6 +141,9 @@ USE_TZ = True
|
|||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
STATIC_ROOT = BASE_DIR / 'staticfiles'
|
STATIC_ROOT = BASE_DIR / 'staticfiles'
|
||||||
|
|
||||||
|
MEDIA_URL = '/media/'
|
||||||
|
MEDIA_ROOT = BASE_DIR / 'media'
|
||||||
|
|
||||||
|
|
||||||
STATICFILES_DIRS = [
|
STATICFILES_DIRS = [
|
||||||
BASE_DIR / 'static',
|
BASE_DIR / 'static',
|
||||||
|
|||||||
@ -15,9 +15,14 @@ Including another URLconf
|
|||||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||||
"""
|
"""
|
||||||
from django.contrib import admin
|
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 = [
|
urlpatterns = [
|
||||||
path("admin/", admin.site.urls),
|
|
||||||
path("", include("core.urls")),
|
path("", include("core.urls")),
|
||||||
|
path("admin/", admin.site.urls),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if settings.DEBUG:
|
||||||
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
|||||||
Binary file not shown.
BIN
core/__pycache__/forms.cpython-311.pyc
Normal file
BIN
core/__pycache__/forms.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,3 +1,7 @@
|
|||||||
from django.contrib import admin
|
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)
|
||||||
|
|||||||
38
core/forms.py
Normal file
38
core/forms.py
Normal file
@ -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(),
|
||||||
|
}
|
||||||
32
core/migrations/0001_initial.py
Normal file
32
core/migrations/0001_initial.py
Normal file
@ -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()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -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')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
@ -1,3 +1,86 @@
|
|||||||
from django.db import models
|
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})"
|
||||||
@ -6,6 +6,30 @@
|
|||||||
{% block head %}{% endblock %}
|
{% block head %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{% block content %}{% endblock %}
|
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="{% url 'cliente_list' %}">Financial CRM</a>
|
||||||
|
<button
|
||||||
|
class="navbar-toggler"
|
||||||
|
type="button"
|
||||||
|
data-bs-toggle="collapse"
|
||||||
|
data-bs-target="#navbarNav"
|
||||||
|
aria-controls="navbarNav"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-label="Toggle navigation"
|
||||||
|
>
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{% url 'cliente_list' %}">Clienti</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="container mt-4">{% block content %} {% endblock %}</main>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -1,14 +1,151 @@
|
|||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
{% block title %}{{ article.title }}{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="container mt-5">
|
<div class="container mt-4">
|
||||||
<h1>{{ article.title }}</h1>
|
<div class="card">
|
||||||
<p class="text-muted">Published on {{ article.created_at|date:"F d, Y" }}</p>
|
<div class="card-header">
|
||||||
<hr>
|
<h2>{{ object.Nome }} {{ object.Cognome }}</h2>
|
||||||
<div>
|
</div>
|
||||||
{{ article.content|safe }}
|
<div class="card-body">
|
||||||
|
<p><strong>Codice Fiscale:</strong> {{ object.Codice_Fiscale }}</p>
|
||||||
|
<p><strong>Email:</strong> {{ object.Email }}</p>
|
||||||
|
<p><strong>Telefono:</strong> {{ object.Telefono }}</p>
|
||||||
|
<p><strong>Data di Nascita:</strong> {{ object.Data_di_Nascita }}</p>
|
||||||
|
<p><strong>Lavoro:</strong> {{ object.Lavoro }}</p>
|
||||||
|
<p><strong>Stato:</strong> {{ object.Stato }}</p>
|
||||||
|
<p><strong>Categoria:</strong> {{ object.Categoria }}</p>
|
||||||
|
<p><strong>Importo Portafoglio Attuale:</strong> € {{ object.Importo_Portafoglio_Attuale }}</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ul class="nav nav-tabs mt-4" id="myTab" role="tablist">
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link active" id="portafogli-tab" data-bs-toggle="tab" data-bs-target="#portafogli" type="button" role="tab" aria-controls="portafogli" aria-selected="true">Portafogli</button>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link" id="attivita-tab" data-bs-toggle="tab" data-bs-target="#attivita" type="button" role="tab" aria-controls="attivita" aria-selected="false">Attività</button>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link" id="documenti-tab" data-bs-toggle="tab" data-bs-target="#documenti" type="button" role="tab" aria-controls="documenti" aria-selected="false">Documenti</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content" id="myTabContent">
|
||||||
|
<div class="tab-pane fade show active" id="portafogli" role="tabpanel" aria-labelledby="portafogli-tab">
|
||||||
|
<div class="d-flex justify-content-end mt-3">
|
||||||
|
<a href="{% url 'portafoglio_new' object.pk %}" class="btn btn-primary mb-3">Aggiungi Portafoglio</a>
|
||||||
|
</div>
|
||||||
|
<div class="table-responsive mt-3">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Nome Portafoglio</th>
|
||||||
|
<th>Profilo di Rischio</th>
|
||||||
|
<th>Valore Iniziale</th>
|
||||||
|
<th>Valore Corrente</th>
|
||||||
|
<th>Data Inizio</th>
|
||||||
|
<th>Azioni</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for portafoglio in portafogli %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ portafoglio.Nome_Portafoglio }}</td>
|
||||||
|
<td>{{ portafoglio.Profilo_di_Rischio }}</td>
|
||||||
|
<td>€ {{ portafoglio.Valore_Iniziale }}</td>
|
||||||
|
<td>€ {{ portafoglio.Valore_Corrente }}</td>
|
||||||
|
<td>{{ portafoglio.Data_Inizio }}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{% url 'portafoglio_edit' portafoglio.pk %}" class="btn btn-sm btn-outline-primary">Modifica</a>
|
||||||
|
<a href="{% url 'portafoglio_delete' portafoglio.pk %}" class="btn btn-sm btn-outline-danger">Elimina</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% empty %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="6">Nessun portafoglio trovato.</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane fade" id="attivita" role="tabpanel" aria-labelledby="attivita-tab">
|
||||||
|
<div class="d-flex justify-content-end mt-3">
|
||||||
|
<a href="{% url 'attivita_new' object.pk %}" class="btn btn-primary mb-3">Aggiungi Attività</a>
|
||||||
|
</div>
|
||||||
|
<div class="table-responsive mt-3">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Data</th>
|
||||||
|
<th>Ora</th>
|
||||||
|
<th>Tipo</th>
|
||||||
|
<th>Stato</th>
|
||||||
|
<th>Note</th>
|
||||||
|
<th>Azioni</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for attivita_item in attivita %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ attivita_item.Data }}</td>
|
||||||
|
<td>{{ attivita_item.Ora|default_if_none:'' }}</td>
|
||||||
|
<td>{{ attivita_item.Tipo }}</td>
|
||||||
|
<td>{{ attivita_item.Stato }}</td>
|
||||||
|
<td>{{ attivita_item.Note }}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{% url 'attivita_edit' attivita_item.pk %}" class="btn btn-sm btn-outline-primary">Modifica</a>
|
||||||
|
<a href="{% url 'attivita_delete' attivita_item.pk %}" class="btn btn-sm btn-outline-danger">Elimina</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% empty %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="6">Nessuna attività trovata.</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane fade" id="documenti" role="tabpanel" aria-labelledby="documenti-tab">
|
||||||
|
<div class="d-flex justify-content-end mt-3">
|
||||||
|
<a href="{% url 'documento_new' object.pk %}" class="btn btn-primary mb-3">Aggiungi Documento</a>
|
||||||
|
</div>
|
||||||
|
<div class="table-responsive mt-3">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Nome Documento</th>
|
||||||
|
<th>Tipo</th>
|
||||||
|
<th>Data Caricamento</th>
|
||||||
|
<th>Data di Scadenza</th>
|
||||||
|
<th>File</th>
|
||||||
|
<th>Azioni</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for documento in documenti %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ documento.Nome_Documento }}</td>
|
||||||
|
<td>{{ documento.Tipo }}</td>
|
||||||
|
<td>{{ documento.Data_Caricamento }}</td>
|
||||||
|
<td>{{ documento.Data_di_Scadenza|default_if_none:'' }}</td>
|
||||||
|
<td><a href="{{ documento.File.url }}">Scarica</a></td>
|
||||||
|
<td>
|
||||||
|
<a href="{% url 'documento_edit' documento.pk %}" class="btn btn-sm btn-outline-primary">Modifica</a>
|
||||||
|
<a href="{% url 'documento_delete' documento.pk %}" class="btn btn-sm btn-outline-danger">Elimina</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% empty %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="6">Nessun documento trovato.</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a href="{% url 'cliente_list' %}" class="btn btn-secondary mt-4">Torna alla lista</a>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
12
core/templates/core/attivita_confirm_delete.html
Normal file
12
core/templates/core/attivita_confirm_delete.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container mt-4">
|
||||||
|
<h2>Sei sicuro di voler eliminare l'attività "{{ object.Tipo }}" del {{ object.Data }}?</h2>
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button type="submit" class="btn btn-danger">Conferma</button>
|
||||||
|
<a href="{% url 'cliente_detail' object.cliente.pk %}" class="btn btn-secondary">Annulla</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
13
core/templates/core/attivita_form.html
Normal file
13
core/templates/core/attivita_form.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container mt-4">
|
||||||
|
<h2>{% if object %}Modifica Attività{% else %}Aggiungi Attività{% endif %}</h2>
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form.as_p }}
|
||||||
|
<button type="submit" class="btn btn-primary">Salva</button>
|
||||||
|
<a href="{% url 'cliente_detail' view.kwargs.cliente_pk|default:object.cliente.pk %}" class="btn btn-secondary">Annulla</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
13
core/templates/core/cliente_confirm_delete.html
Normal file
13
core/templates/core/cliente_confirm_delete.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container mt-4">
|
||||||
|
<h1>Delete Client</h1>
|
||||||
|
<p>Are you sure you want to delete {{ object.Nome }} {{ object.Cognome }}?</p>
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button type="submit" class="btn btn-danger">Delete</button>
|
||||||
|
<a href="{% url 'cliente_list' %}" class="btn btn-secondary">Cancel</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
13
core/templates/core/cliente_form.html
Normal file
13
core/templates/core/cliente_form.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container mt-4">
|
||||||
|
<h1>{% if form.instance.pk %}Edit Client{% else %}Add Client{% endif %}</h1>
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form.as_p }}
|
||||||
|
<button type="submit" class="btn btn-primary">Save</button>
|
||||||
|
<a href="{% url 'cliente_list' %}" class="btn btn-secondary">Cancel</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
12
core/templates/core/documento_confirm_delete.html
Normal file
12
core/templates/core/documento_confirm_delete.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container mt-4">
|
||||||
|
<h2>Sei sicuro di voler eliminare il documento "{{ object.Nome_Documento }}"?</h2>
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button type="submit" class="btn btn-danger">Conferma</button>
|
||||||
|
<a href="{% url 'cliente_detail' object.cliente.pk %}" class="btn btn-secondary">Annulla</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
13
core/templates/core/documento_form.html
Normal file
13
core/templates/core/documento_form.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container mt-4">
|
||||||
|
<h2>{% if object %}Modifica Documento{% else %}Aggiungi Documento{% endif %}</h2>
|
||||||
|
<form method="post" enctype="multipart/form-data">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form.as_p }}
|
||||||
|
<button type="submit" class="btn btn-primary">Salva</button>
|
||||||
|
<a href="{% url 'cliente_detail' view.kwargs.cliente_pk|default:object.cliente.pk %}" class="btn btn-secondary">Annulla</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@ -1,154 +1,44 @@
|
|||||||
{% extends "base.html" %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
{% block title %}{{ project_name }}{% endblock %}
|
|
||||||
|
|
||||||
{% block head %}
|
|
||||||
{% if project_description %}
|
|
||||||
<meta name="description" content="{{ project_description }}">
|
|
||||||
<meta property="og:description" content="{{ project_description }}">
|
|
||||||
<meta property="twitter:description" content="{{ project_description }}">
|
|
||||||
{% endif %}
|
|
||||||
{% if project_image_url %}
|
|
||||||
<meta property="og:image" content="{{ project_image_url }}">
|
|
||||||
<meta property="twitter:image" content="{{ project_image_url }}">
|
|
||||||
{% endif %}
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-color-start: #6a11cb;
|
|
||||||
--bg-color-end: #2575fc;
|
|
||||||
--text-color: #ffffff;
|
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'><path d='M-10 10L110 10M10 -10L10 110' stroke-width='1' stroke='rgba(255,255,255,0.05)'/></svg>");
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% {
|
|
||||||
background-position: 0% 0%;
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
background-position: 100% 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2.5rem 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: clamp(2.2rem, 3vw + 1.2rem, 3.2rem);
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1.2rem;
|
|
||||||
letter-spacing: -0.02em;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
opacity: 0.92;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loader {
|
|
||||||
margin: 1.5rem auto;
|
|
||||||
width: 56px;
|
|
||||||
height: 56px;
|
|
||||||
border: 4px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes spin {
|
|
||||||
to {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.runtime code {
|
|
||||||
background: rgba(0, 0, 0, 0.25);
|
|
||||||
padding: 0.15rem 0.45rem;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px;
|
|
||||||
height: 1px;
|
|
||||||
padding: 0;
|
|
||||||
margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
border: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
opacity: 0.75;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<main>
|
<div class="container mt-4">
|
||||||
<div class="card">
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
<h1>Analyzing your requirements and generating your app…</h1>
|
<h1>Clienti</h1>
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<a href="{% url 'cliente_new' %}" class="btn btn-primary">Add Client</a>
|
||||||
<span class="sr-only">Loading…</span>
|
|
||||||
</div>
|
</div>
|
||||||
<p class="hint">AppWizzy AI is collecting your requirements and applying the first changes.</p>
|
<div class="table-responsive">
|
||||||
<p class="hint">This page will refresh automatically as the plan is implemented.</p>
|
<table class="table table-striped">
|
||||||
<p class="runtime">
|
<thead>
|
||||||
Runtime: Django <code>{{ django_version }}</code> · Python <code>{{ python_version }}</code>
|
<tr>
|
||||||
— UTC <code>{{ current_time|date:"Y-m-d H:i:s" }}</code>
|
<th>Nome</th>
|
||||||
</p>
|
<th>Cognome</th>
|
||||||
</div>
|
<th>Codice Fiscale</th>
|
||||||
</main>
|
<th>Email</th>
|
||||||
<footer>
|
<th>Telefono</th>
|
||||||
Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC)
|
<th>Stato</th>
|
||||||
</footer>
|
<th>Categoria</th>
|
||||||
{% endblock %}
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for cliente in clienti %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ cliente.Nome }}</td>
|
||||||
|
<td>{{ cliente.Cognome }}</td>
|
||||||
|
<td>{{ cliente.Codice_Fiscale }}</td>
|
||||||
|
<td>{{ cliente.Email }}</td>
|
||||||
|
<td>{{ cliente.Telefono }}</td>
|
||||||
|
<td>{{ cliente.Stato }}</td>
|
||||||
|
<td>{{ cliente.Categoria }}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{% url 'cliente_detail' cliente.pk %}" class="btn btn-sm btn-outline-info">Details</a>
|
||||||
|
<a href="{% url 'cliente_edit' cliente.pk %}" class="btn btn-sm btn-outline-primary">Edit</a>
|
||||||
|
<a href="{% url 'cliente_delete' cliente.pk %}" class="btn btn-sm btn-outline-danger">Delete</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|||||||
12
core/templates/core/portafoglio_confirm_delete.html
Normal file
12
core/templates/core/portafoglio_confirm_delete.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container mt-4">
|
||||||
|
<h2>Sei sicuro di voler eliminare il portafoglio "{{ object.Nome_Portafoglio }}"?</h2>
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button type="submit" class="btn btn-danger">Conferma</button>
|
||||||
|
<a href="{% url 'cliente_detail' object.cliente.pk %}" class="btn btn-secondary">Annulla</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
13
core/templates/core/portafoglio_form.html
Normal file
13
core/templates/core/portafoglio_form.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container mt-4">
|
||||||
|
<h2>{% if object %}Modifica Portafoglio{% else %}Aggiungi Portafoglio{% endif %}</h2>
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form.as_p }}
|
||||||
|
<button type="submit" class="btn btn-primary">Salva</button>
|
||||||
|
<a href="{% url 'cliente_detail' view.kwargs.cliente_pk|default:object.cliente.pk %}" class="btn btn-secondary">Annulla</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
41
core/urls.py
41
core/urls.py
@ -1,7 +1,40 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
from .views import (
|
||||||
from .views import home
|
ClienteListView,
|
||||||
|
ClienteDetailView,
|
||||||
|
ClienteCreateView,
|
||||||
|
ClienteUpdateView,
|
||||||
|
ClienteDeleteView,
|
||||||
|
PortafoglioCreateView,
|
||||||
|
PortafoglioUpdateView,
|
||||||
|
PortafoglioDeleteView,
|
||||||
|
AttivitaCreateView,
|
||||||
|
AttivitaUpdateView,
|
||||||
|
AttivitaDeleteView,
|
||||||
|
DocumentoCreateView,
|
||||||
|
DocumentoUpdateView,
|
||||||
|
DocumentoDeleteView,
|
||||||
|
)
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", home, name="home"),
|
path('', ClienteListView.as_view(), name='cliente_list'),
|
||||||
]
|
path('cliente/<int:pk>/', ClienteDetailView.as_view(), name='cliente_detail'),
|
||||||
|
path('cliente/new/', ClienteCreateView.as_view(), name='cliente_new'),
|
||||||
|
path('cliente/<int:pk>/edit/', ClienteUpdateView.as_view(), name='cliente_edit'),
|
||||||
|
path('cliente/<int:pk>/delete/', ClienteDeleteView.as_view(), name='cliente_delete'),
|
||||||
|
|
||||||
|
# Portafoglio URLs
|
||||||
|
path('cliente/<int:cliente_pk>/portafoglio/new/', PortafoglioCreateView.as_view(), name='portafoglio_new'),
|
||||||
|
path('portafoglio/<int:pk>/edit/', PortafoglioUpdateView.as_view(), name='portafoglio_edit'),
|
||||||
|
path('portafoglio/<int:pk>/delete/', PortafoglioDeleteView.as_view(), name='portafoglio_delete'),
|
||||||
|
|
||||||
|
# Attivita URLs
|
||||||
|
path('cliente/<int:cliente_pk>/attivita/new/', AttivitaCreateView.as_view(), name='attivita_new'),
|
||||||
|
path('attivita/<int:pk>/edit/', AttivitaUpdateView.as_view(), name='attivita_edit'),
|
||||||
|
path('attivita/<int:pk>/delete/', AttivitaDeleteView.as_view(), name='attivita_delete'),
|
||||||
|
|
||||||
|
# Documento URLs
|
||||||
|
path('cliente/<int:cliente_pk>/documento/new/', DocumentoCreateView.as_view(), name='documento_new'),
|
||||||
|
path('documento/<int:pk>/edit/', DocumentoUpdateView.as_view(), name='documento_edit'),
|
||||||
|
path('documento/<int:pk>/delete/', DocumentoDeleteView.as_view(), name='documento_delete'),
|
||||||
|
]
|
||||||
158
core/views.py
158
core/views.py
@ -1,25 +1,141 @@
|
|||||||
import os
|
from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView
|
||||||
import platform
|
from django.urls import reverse_lazy, reverse
|
||||||
|
from .models import Cliente, Portafoglio, Attivita, Documento
|
||||||
|
from .forms import ClienteForm, PortafoglioForm, AttivitaForm, DocumentoForm
|
||||||
|
from django.shortcuts import get_object_or_404
|
||||||
|
|
||||||
from django import get_version as django_version
|
class ClienteListView(ListView):
|
||||||
from django.shortcuts import render
|
model = Cliente
|
||||||
from django.utils import timezone
|
template_name = 'core/index.html'
|
||||||
|
context_object_name = 'clienti'
|
||||||
|
|
||||||
|
class ClienteDetailView(DetailView):
|
||||||
|
model = Cliente
|
||||||
|
template_name = 'core/article_detail.html'
|
||||||
|
|
||||||
def home(request):
|
def get_context_data(self, **kwargs):
|
||||||
"""Render the landing screen with loader and environment details."""
|
context = super().get_context_data(**kwargs)
|
||||||
host_name = request.get_host().lower()
|
cliente = self.get_object()
|
||||||
agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic"
|
context['portafogli'] = cliente.portafogli.all()
|
||||||
now = timezone.now()
|
context['attivita'] = cliente.attivita.all()
|
||||||
|
context['documenti'] = cliente.documenti.all()
|
||||||
|
return context
|
||||||
|
|
||||||
context = {
|
class ClienteCreateView(CreateView):
|
||||||
"project_name": "New Style",
|
model = Cliente
|
||||||
"agent_brand": agent_brand,
|
template_name = 'core/cliente_form.html'
|
||||||
"django_version": django_version(),
|
form_class = ClienteForm
|
||||||
"python_version": platform.python_version(),
|
success_url = reverse_lazy('cliente_list')
|
||||||
"current_time": now,
|
|
||||||
"host_name": host_name,
|
class ClienteUpdateView(UpdateView):
|
||||||
"project_description": os.getenv("PROJECT_DESCRIPTION", ""),
|
model = Cliente
|
||||||
"project_image_url": os.getenv("PROJECT_IMAGE_URL", ""),
|
template_name = 'core/cliente_form.html'
|
||||||
}
|
form_class = ClienteForm
|
||||||
return render(request, "core/index.html", context)
|
success_url = reverse_lazy('cliente_list')
|
||||||
|
|
||||||
|
class ClienteDeleteView(DeleteView):
|
||||||
|
model = Cliente
|
||||||
|
template_name = 'core/cliente_confirm_delete.html'
|
||||||
|
success_url = reverse_lazy('cliente_list')
|
||||||
|
|
||||||
|
# Portafoglio Views
|
||||||
|
class PortafoglioCreateView(CreateView):
|
||||||
|
model = Portafoglio
|
||||||
|
form_class = PortafoglioForm
|
||||||
|
template_name = 'core/portafoglio_form.html'
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
context['cliente_pk'] = self.kwargs['cliente_pk']
|
||||||
|
return context
|
||||||
|
|
||||||
|
def form_valid(self, form):
|
||||||
|
cliente = get_object_or_404(Cliente, pk=self.kwargs['cliente_pk'])
|
||||||
|
form.instance.cliente = cliente
|
||||||
|
return super().form_valid(form)
|
||||||
|
|
||||||
|
def get_success_url(self):
|
||||||
|
return reverse('cliente_detail', kwargs={'pk': self.kwargs['cliente_pk']})
|
||||||
|
|
||||||
|
class PortafoglioUpdateView(UpdateView):
|
||||||
|
model = Portafoglio
|
||||||
|
form_class = PortafoglioForm
|
||||||
|
template_name = 'core/portafoglio_form.html'
|
||||||
|
|
||||||
|
def get_success_url(self):
|
||||||
|
return reverse('cliente_detail', kwargs={'pk': self.object.cliente.pk})
|
||||||
|
|
||||||
|
class PortafoglioDeleteView(DeleteView):
|
||||||
|
model = Portafoglio
|
||||||
|
template_name = 'core/portafoglio_confirm_delete.html'
|
||||||
|
|
||||||
|
def get_success_url(self):
|
||||||
|
return reverse('cliente_detail', kwargs={'pk': self.object.cliente.pk})
|
||||||
|
|
||||||
|
# Attivita Views
|
||||||
|
class AttivitaCreateView(CreateView):
|
||||||
|
model = Attivita
|
||||||
|
form_class = AttivitaForm
|
||||||
|
template_name = 'core/attivita_form.html'
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
context['cliente_pk'] = self.kwargs['cliente_pk']
|
||||||
|
return context
|
||||||
|
|
||||||
|
def form_valid(self, form):
|
||||||
|
cliente = get_object_or_404(Cliente, pk=self.kwargs['cliente_pk'])
|
||||||
|
form.instance.cliente = cliente
|
||||||
|
return super().form_valid(form)
|
||||||
|
|
||||||
|
def get_success_url(self):
|
||||||
|
return reverse('cliente_detail', kwargs={'pk': self.kwargs['cliente_pk']})
|
||||||
|
|
||||||
|
class AttivitaUpdateView(UpdateView):
|
||||||
|
model = Attivita
|
||||||
|
form_class = AttivitaForm
|
||||||
|
template_name = 'core/attivita_form.html'
|
||||||
|
|
||||||
|
def get_success_url(self):
|
||||||
|
return reverse('cliente_detail', kwargs={'pk': self.object.cliente.pk})
|
||||||
|
|
||||||
|
class AttivitaDeleteView(DeleteView):
|
||||||
|
model = Attivita
|
||||||
|
template_name = 'core/attivita_confirm_delete.html'
|
||||||
|
|
||||||
|
def get_success_url(self):
|
||||||
|
return reverse('cliente_detail', kwargs={'pk': self.object.cliente.pk})
|
||||||
|
|
||||||
|
# Documento Views
|
||||||
|
class DocumentoCreateView(CreateView):
|
||||||
|
model = Documento
|
||||||
|
form_class = DocumentoForm
|
||||||
|
template_name = 'core/documento_form.html'
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
context['cliente_pk'] = self.kwargs['cliente_pk']
|
||||||
|
return context
|
||||||
|
|
||||||
|
def form_valid(self, form):
|
||||||
|
cliente = get_object_or_404(Cliente, pk=self.kwargs['cliente_pk'])
|
||||||
|
form.instance.cliente = cliente
|
||||||
|
return super().form_valid(form)
|
||||||
|
|
||||||
|
def get_success_url(self):
|
||||||
|
return reverse('cliente_detail', kwargs={'pk': self.kwargs['cliente_pk']})
|
||||||
|
|
||||||
|
class DocumentoUpdateView(UpdateView):
|
||||||
|
model = Documento
|
||||||
|
form_class = DocumentoForm
|
||||||
|
template_name = 'core/documento_form.html'
|
||||||
|
|
||||||
|
def get_success_url(self):
|
||||||
|
return reverse('cliente_detail', kwargs={'pk': self.object.cliente.pk})
|
||||||
|
|
||||||
|
class DocumentoDeleteView(DeleteView):
|
||||||
|
model = Documento
|
||||||
|
template_name = 'core/documento_confirm_delete.html'
|
||||||
|
|
||||||
|
def get_success_url(self):
|
||||||
|
return reverse('cliente_detail', kwargs={'pk': self.object.cliente.pk})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user