On Fri, Jan 16, 2009 at 7:14 AM, Marco Minutoli <[email protected]>wrote:
>
> I have these three models:
>
> class Address(models.Model):
> name = models.CharField(max_length=100)
> ## many other fields ##
>
> class Meta:
> ordering = ('name',)
>
> def __unicode__(self):
> return self.name
>
>
> class Organization(models.Model):
> name = models.CharField(max_length=100)
> ## many other fields ##
>
> class Meta:
> ordering = ('name',)
>
> def __unicode__(self):
> return self.name
>
>
> class OrganizationAddress(Address):
> organization = models.ForeignKey (
> Organization,
> related_name = "addresses",
> )
>
> When i try to add/edit an organization and add one addresses i've got
> this error:
>
> " ValueError: Cannot assign None:
> "OrganizationAddress.address_ptr" does not allow null values. "
>
> 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.
> Is a django's bug or i've made something wrong?
>
It isn't immediately clear to me why r9664 would have broken this. You
might want to open a ticket so this doesn't get forgotten -- unfortunately I
do not have time to look at this in detail right now.
Karen
> Below a code portion to test the problem.
>
> """
> from django.forms.models import inlineformset_factory
> from my_apps.models import Organization, Address, OrganizationAddress
>
> Organization(name='test').save()
> org = Organization.objects.get(name='test')
>
> inline_formset = inlineformset_factory(Organization,
> OrganizationAddress, can_delete=False, extra=2)
>
> data = {
> 'addresses-TOTAL_FORMS': '2', # the number of forms rendered
> 'addresses-INITIAL_FORMS': '0', # the number of forms with initial data
> 'addresses-0-name': 'Test test',
> }
>
> formset = inline_formset(data, instance=org)
>
> formset.is_valid()
> formset.save()
> """
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---