Alessandro, see the documentation for the "core" model field option:
http://www.djangoproject.com/documentation/model-api/#core

You should set core=True on some field that must otherwise be present in an
address.  Looks like "indirizzo" is such a field.

  -- Scott

On Sat, Jun 21, 2008 at 7:37 AM, Alessandro Ronchi <
[EMAIL PROTECTED]> wrote:

> I am trying to let admin users edit related field in one single page.
>
> I have a company model that has many addresses, so I've decided to use
> a Company model and an Address model with foreignkey(Company,
> edit_inline=models.STACKED)
> It works correcly until I've edit the company: IT DELETES ALL MY
> ASSOCIATED ADDRESSES if I click on Save() of my company.
>
> How can I avoid this?
> Is there a solution?
>
> Anyone uses edit_inline without problems?
>
> class Impresa(models.Model):
>    codice = models.CharField(max_length=10,blank=False,  primary_key=True)
>    utente = models.ForeignKey(User, blank=True, null=True, unique=True)
>    ragione_sociale = models.CharField(max_length=100)
>
> class Indirizzo(models.Model):
>    impresa = models.ForeignKey(Impresa)#, edit_inline=models.STACKED,
> core=True, related_name="indirizzi")
>    tipologia= models.CharField(max_length=2, blank=True, null=True,
> choices=TIPO_INDIRIZZO)
>    indirizzo = models.CharField(max_length=100)
>    cap = models.CharField(max_length=10, blank=True, null=True)
>    citta = models.CharField(max_length=100, blank=True, null=True)
>    provincia = models.CharField(max_length=2, blank=True, null=True,
> choices=PROVINCE, default='FC')
>
>
> --
> Alessandro Ronchi
> Skype: aronchi
> http://www.alessandroronchi.net
>
> SOASI Soc.Coop. - www.soasi.com
> Sviluppo Software e Sistemi Open Source
> Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
> Tel.: +39 0543 798985 - Fax: +39 0543 579928
>
> Rispetta l'ambiente: se non ti è necessario, non stampare questa mail
>
> >
>


-- 
http://scott.andstuff.org/ | http://truthadorned.org/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to