Rinominata PersonaContattoAzienda in ContattoAziendale
parent
a45fc9ddee
commit
c2b5d1abd5
|
|
@ -49,9 +49,9 @@ class CachingPaginator(Paginator):
|
||||||
# --------------- FINE PREFISSO TEMPLATE ---------------
|
# --------------- FINE PREFISSO TEMPLATE ---------------
|
||||||
|
|
||||||
|
|
||||||
@admin.register(models.PersonaContattoAzienda)
|
@admin.register(models.ContattoAziendale)
|
||||||
class PersonaContattoAziendaAdmin(ImportExportModelAdmin):
|
class ContattoAziendaleAdmin(ImportExportModelAdmin):
|
||||||
# resource = resources.PersonaContattoAziendaResource
|
# resource = resources.ContattoAziendaleResource
|
||||||
# list_per_page = 15
|
# list_per_page = 15
|
||||||
# paginator = CachingPaginator
|
# paginator = CachingPaginator
|
||||||
# show_full_result_count = False
|
# show_full_result_count = False
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Generated by Django 4.2.2 on 2023-06-20 09:50
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("contatti_app", "0001_initial"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="email",
|
||||||
|
name="indirizzo_email",
|
||||||
|
field=models.EmailField(max_length=254),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
# Generated by Django 4.2.2 on 2023-06-20 13:30
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("contatti_app", "0002_alter_email_indirizzo_email"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="ContattoAziendale",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.AutoField(
|
||||||
|
auto_created=True,
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
verbose_name="ID",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("is_personale", models.BooleanField(default=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"verbose_name": "Contatto aziendale",
|
||||||
|
"verbose_name_plural": "Contatti aziendali",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="personacontattoazienda",
|
||||||
|
name="azienda",
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="personacontattoazienda",
|
||||||
|
name="personafisica_ptr",
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
# Generated by Django 4.2.2 on 2023-06-20 13:30
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("contatti_app", "0003_contattoaziendale_and_more"),
|
||||||
|
("offerte_app", "0002_alter_destinatarioofferta_intestatario"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name="PersonaContattoAzienda",
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="contattoaziendale",
|
||||||
|
name="azienda",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
related_name="contatti_azienda",
|
||||||
|
to="contatti_app.societa",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="contattoaziendale",
|
||||||
|
name="persona",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
related_name="aziende_correlate",
|
||||||
|
to="contatti_app.personafisica",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
<type label="SET" length="1" sql="SET" quote=""/>
|
<type label="SET" length="1" sql="SET" quote=""/>
|
||||||
<type label="Bit" length="0" sql="bit" quote=""/>
|
<type label="Bit" length="0" sql="bit" quote=""/>
|
||||||
</group>
|
</group>
|
||||||
</datatypes><table x="1241" y="636" name="PersonaContattoAzienda">
|
</datatypes><table x="1241" y="636" name="ContattoAziendale">
|
||||||
<row name="personafisica_ptr" null="1" autoincrement="1">
|
<row name="personafisica_ptr" null="1" autoincrement="1">
|
||||||
<datatype>INTEGER</datatype>
|
<datatype>INTEGER</datatype>
|
||||||
<default>NULL</default><relation table="PersonaFisica" row="soggettocontattabile_ptr" />
|
<default>NULL</default><relation table="PersonaFisica" row="soggettocontattabile_ptr" />
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ class Email(VoceContattoRubrica):
|
||||||
eml += ' (!)'
|
eml += ' (!)'
|
||||||
return eml
|
return eml
|
||||||
|
|
||||||
indirizzo_email = models.CharField(null=False,blank=False,max_length=30)
|
indirizzo_email = models.EmailField(null=False,blank=False,max_length=254)
|
||||||
note = models.CharField(null=False,blank=True,default='', max_length=64)
|
note = models.CharField(null=False,blank=True,default='', max_length=64)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -104,7 +104,11 @@ class Pec(Email):
|
||||||
verbose_name_plural = 'pec'
|
verbose_name_plural = 'pec'
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"Pec (id: {self.id})"
|
eml = self.indirizzo_email
|
||||||
|
if self.note:
|
||||||
|
eml += ' (!)'
|
||||||
|
return eml
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Fax(VoceContattoRubrica):
|
class Fax(VoceContattoRubrica):
|
||||||
|
|
@ -158,14 +162,16 @@ class Societa(models.Model):
|
||||||
blank=True, related_name="societa")
|
blank=True, related_name="societa")
|
||||||
|
|
||||||
|
|
||||||
class PersonaContattoAzienda(PersonaFisica):
|
class ContattoAziendale(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = 'personacontattoazienda'
|
verbose_name = 'Contatto aziendale'
|
||||||
verbose_name_plural = 'personacontattoazienda'
|
verbose_name_plural = 'Contatti aziendali'
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"PersonaContattoAzienda (id: {self.id})"
|
return f"ContattoAziendale (id: {self.id})"
|
||||||
|
|
||||||
azienda = models.ForeignKey(Societa, on_delete=models.CASCADE, null=False,
|
azienda = models.ForeignKey(Societa, on_delete=models.CASCADE, null=False,
|
||||||
blank=False, related_name='persone')
|
blank=False, related_name='contatti_azienda')
|
||||||
|
persona = models.ForeignKey(PersonaFisica, on_delete=models.CASCADE, null=False,
|
||||||
|
blank=False, related_name='aziende_correlate')
|
||||||
is_personale = models.BooleanField(null=False, blank=False, default=True)
|
is_personale = models.BooleanField(null=False, blank=False, default=True)
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ from . import models
|
||||||
# --------------- FINE PREFISSO TEMPLATE ---------------
|
# --------------- FINE PREFISSO TEMPLATE ---------------
|
||||||
|
|
||||||
|
|
||||||
class PersonaContattoAziendaResource(resources.ModelResource):
|
class ContattoAziendaleResource(resources.ModelResource):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.PersonaContattoAzienda
|
model = models.ContattoAziendale
|
||||||
|
|
||||||
|
|
||||||
class VoceContattoRubricaResource(resources.ModelResource):
|
class VoceContattoRubricaResource(resources.ModelResource):
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ from . import models
|
||||||
# --------------- FINE PREFISSO TEMPLATE ---------------
|
# --------------- FINE PREFISSO TEMPLATE ---------------
|
||||||
|
|
||||||
|
|
||||||
class PersonaContattoAziendaSerializer(serializers.ModelSerializer):
|
class ContattoAziendaleSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.PersonaContattoAzienda
|
model = models.ContattoAziendale
|
||||||
fields = ('azienda', 'is_personale')
|
fields = ('azienda', 'is_personale')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ router = routers.DefaultRouter()
|
||||||
|
|
||||||
# --------------- FINE PREFISSO TEMPLATE ---------------
|
# --------------- FINE PREFISSO TEMPLATE ---------------
|
||||||
|
|
||||||
router.register(r'personacontattoazienda', views.PersonaContattoAzienda_View)
|
router.register(r'ContattoAziendale', views.ContattoAziendale_View)
|
||||||
router.register(r'vocecontattorubrica', views.VoceContattoRubrica_View)
|
router.register(r'vocecontattorubrica', views.VoceContattoRubrica_View)
|
||||||
router.register(r'telefono', views.Telefono_View)
|
router.register(r'telefono', views.Telefono_View)
|
||||||
router.register(r'email', views.Email_View)
|
router.register(r'email', views.Email_View)
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,12 @@ from . import serializers
|
||||||
# --------------- FINE PREFISSO TEMPLATE ---------------
|
# --------------- FINE PREFISSO TEMPLATE ---------------
|
||||||
|
|
||||||
|
|
||||||
class PersonaContattoAzienda_View(viewsets.ModelViewSet):
|
class ContattoAziendale_View(viewsets.ModelViewSet):
|
||||||
# authentication_classes = [BasicAuthentication, SessionAuthentication, TokenAuthentication]
|
# authentication_classes = [BasicAuthentication, SessionAuthentication, TokenAuthentication]
|
||||||
# permission_classes = [DjangoModelPermissions]
|
# permission_classes = [DjangoModelPermissions]
|
||||||
|
|
||||||
queryset = models.PersonaContattoAzienda.objects.all()
|
queryset = models.ContattoAziendale.objects.all()
|
||||||
serializer_class = serializers.PersonaContattoAziendaSerializer
|
serializer_class = serializers.ContattoAziendaleSerializer
|
||||||
|
|
||||||
|
|
||||||
class VoceContattoRubrica_View(viewsets.ModelViewSet):
|
class VoceContattoRubrica_View(viewsets.ModelViewSet):
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
# Generated by Django 4.2.2 on 2023-06-20 13:30
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("contatti_app", "0003_contattoaziendale_and_more"),
|
||||||
|
("offerte_app", "0001_initial"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="destinatarioofferta",
|
||||||
|
name="intestatario",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
related_name="DestinatarioOfferta_da_contatti_appContattoAziendale_intestatario",
|
||||||
|
to="contatti_app.contattoaziendale",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -11,8 +11,8 @@ class DestinatarioOfferta(models.Model):
|
||||||
|
|
||||||
destinazione = models.ForeignKey('contatti_app.Sede', on_delete=models.CASCADE, null=True,
|
destinazione = models.ForeignKey('contatti_app.Sede', on_delete=models.CASCADE, null=True,
|
||||||
blank=True, related_name="DestinatarioOfferta_da_Sede_destinazione")
|
blank=True, related_name="DestinatarioOfferta_da_Sede_destinazione")
|
||||||
intestatario = models.ForeignKey('contatti_app.PersonaContattoAzienda', on_delete=models.CASCADE, null=True,
|
intestatario = models.ForeignKey('contatti_app.ContattoAziendale', on_delete=models.CASCADE, null=True,
|
||||||
blank=True, related_name="DestinatarioOfferta_da_contatti_appPersonaContattoAzienda_intestatario")
|
blank=True, related_name="DestinatarioOfferta_da_contatti_appContattoAziendale_intestatario")
|
||||||
|
|
||||||
|
|
||||||
class GruppoOfferte(models.Model):
|
class GruppoOfferte(models.Model):
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
<default>NULL</default></row>
|
<default>NULL</default></row>
|
||||||
<row name="intestatario" null="1" autoincrement="0">
|
<row name="intestatario" null="1" autoincrement="0">
|
||||||
<datatype>INTEGER</datatype>
|
<datatype>INTEGER</datatype>
|
||||||
<default>NULL</default><relation table="PersonaContattoAzienda" row="persona_ptr" />
|
<default>NULL</default><relation table="ContattoAziendale" row="persona_ptr" />
|
||||||
</row>
|
</row>
|
||||||
<key type="PRIMARY" name="">
|
<key type="PRIMARY" name="">
|
||||||
<part>id</part>
|
<part>id</part>
|
||||||
|
|
@ -214,7 +214,7 @@
|
||||||
<part>id</part>
|
<part>id</part>
|
||||||
</key>
|
</key>
|
||||||
</table>
|
</table>
|
||||||
<table x="1929" y="1703" name="PersonaContattoAzienda">
|
<table x="1929" y="1703" name="ContattoAziendale">
|
||||||
<row name="azienda" null="1" autoincrement="0">
|
<row name="azienda" null="1" autoincrement="0">
|
||||||
<datatype>INTEGER</datatype>
|
<datatype>INTEGER</datatype>
|
||||||
<default>NULL</default><relation table="SoggettoFiscale" row="id" />
|
<default>NULL</default><relation table="SoggettoFiscale" row="id" />
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
<default>NULL</default></row>
|
<default>NULL</default></row>
|
||||||
<row name="intestatario" null="1" autoincrement="0">
|
<row name="intestatario" null="1" autoincrement="0">
|
||||||
<datatype>INTEGER</datatype>
|
<datatype>INTEGER</datatype>
|
||||||
<default>NULL</default><relation table="PersonaContattoAzienda" row="personafisica_ptr" />
|
<default>NULL</default><relation table="ContattoAziendale" row="personafisica_ptr" />
|
||||||
</row>
|
</row>
|
||||||
<key type="PRIMARY" name="">
|
<key type="PRIMARY" name="">
|
||||||
<part>id</part>
|
<part>id</part>
|
||||||
|
|
@ -212,7 +212,7 @@
|
||||||
<part>id</part>
|
<part>id</part>
|
||||||
</key>
|
</key>
|
||||||
</table>
|
</table>
|
||||||
<table x="1241" y="636" name="PersonaContattoAzienda">
|
<table x="1241" y="636" name="ContattoAziendale">
|
||||||
<row name="personafisica_ptr" null="1" autoincrement="1">
|
<row name="personafisica_ptr" null="1" autoincrement="1">
|
||||||
<datatype>INTEGER</datatype>
|
<datatype>INTEGER</datatype>
|
||||||
<default>NULL</default><relation table="PersonaFisica" row="soggettocontattabile_ptr" />
|
<default>NULL</default><relation table="PersonaFisica" row="soggettocontattabile_ptr" />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue