Code

Changes between Initial Version and Version 1 of Ticket #10075


Ignore:
Timestamp:
01/20/09 01:06:54 (5 years ago)
Author:
ramiro
Comment:

(edited description, please please use the 'Preview' button when submitting a ticket)

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #10075

    • Property Needs documentation unset
    • Property Needs tests unset
    • Property Patch needs improvement unset
  • Ticket #10075 – Description

    initial v1  
    11I have these three models: 
    22 
     3{{{ 
    34class Address(models.Model): 
    45   name = models.CharField(max_length=100) 
     
    2829       related_name = "addresses", 
    2930   ) 
     31}}} 
    3032 
    3133When i try to add/edit an organization and add one address i've got this error: 
    3234 
     35{{{ 
    3336      " ValueError: Cannot assign None: "OrganizationAddress.address_ptr" does not allow null values. " 
     37}}} 
    3438 
    35 I've tried to understand the problem (because it happened since one day to another..) and i've found that the problem was born after the django commit of the changeset 9664. 
     39I've tried to understand the problem (because it happened since one day to another..) and i've found that the problem was born after the django commit of the changeset [9664] 
    3640 
    3741This is the "incriminated code" of changeset: 
     42{{{ 
    3843        488             if fk_attname == self._pk_field.attname:  
    3944        489                 exclude =  [self._pk_field.name]  
    4045        490             else:  
    4146        491                 exclude = [] 
     47}}} 
    4248 
    4349I have "organization_id" in the fk_attname e "address_ptr" in the self._pk_field.attname and so the primary_key wasn't insert in the exclude list. 
     
    4551Below a code portion to test the problem. 
    4652 
    47 """ 
     53{{{ 
    4854from django.forms.models import inlineformset_factory 
    4955from my_apps.models import Organization, Address, OrganizationAddress 
     
    6470formset.is_valid() 
    6571formset.save() 
    66 """  
     72}}} 
    6773 
    6874Sorry for my english.