Re: [Django] #11807: Admin inlines onetoone related object not saved

2011-06-04 Thread Django
#11807: Admin inlines onetoone related object not saved
-+-
   Reporter:  nemesys@…  |  Owner:  nobody
   Type:  Bug| Status:  closed
  Milestone: |  Component:  contrib.admin
Version:  1.1|   Severity:  Normal
 Resolution:  duplicate  |   Keywords:  admin inline
   Triage Stage:  Design |  onetoone save
  decision needed|  Has patch:  0
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  1  |  Easy pickings:  0
-+-
Changes (by julien):

 * status:  new => closed
 * resolution:   => duplicate
 * easy:   => 0


Comment:

 I'm going to close this one as a dupe of #14832 on the basis that it's
 been accepted and that it has a slightly clearer description.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

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



Re: [Django] #11807: Admin inlines onetoone related object not saved

2009-08-31 Thread Django
#11807: Admin inlines onetoone related object not saved
--+-
  Reporter:  neme...@twilightzone.lu  | Owner:  nobody  
  
Status:  new  | Milestone:  
  
 Component:  django.contrib.admin |   Version:  1.1 
  
Resolution:   |  Keywords:  admin inline 
onetoone save
 Stage:  Design decision needed   | Has_patch:  0   
  
Needs_docs:  0|   Needs_tests:  0   
  
Needs_better_patch:  1|  
--+-
Comment (by neme...@twilightzone.lu):

 Sry for the initial formatting. What about leaving that decision to the
 app designer/developer by introducing a boolean flag for it? Default
 behaviour would be the current one - else save it as new object. Extending
 a model over several models isnt unusual, especially if you are going to
 remove normalization on a db scheme due to performance issues.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #11807: Admin inlines onetoone related object not saved

2009-08-31 Thread Django
#11807: Admin inlines onetoone related object not saved
--+-
  Reporter:  neme...@twilightzone.lu  | Owner:  nobody  
  
Status:  new  | Milestone:  
  
 Component:  django.contrib.admin |   Version:  1.1 
  
Resolution:   |  Keywords:  admin inline 
onetoone save
 Stage:  Design decision needed   | Has_patch:  0   
  
Needs_docs:  0|   Needs_tests:  0   
  
Needs_better_patch:  1|  
--+-
Changes (by kmtracey):

  * stage:  Unreviewed => Design decision needed

Old description:

> Hi there,
>
> I have the following models:
>
> class A(models.Model):
>id = models.AutoField(primary_key=True)
>
> class B(models.Model):
>mya = models.OneToOneField(A, primary_key=True)
>text = models.TextField(default='Init')
>
> In admin interface, I have used an inline to include B when
> changing/adding an A. Adding/Changing an A without touching the B inline
> results in A beeing saved, but not B. Changing the textfield from B into
> sth other than default and it works, but I want the default beeing saved
> too.
>
> Thanks!
> Jean

New description:

 Hi there,

 I have the following models:

 {{{
 #!python
 class A(models.Model):
id = models.AutoField(primary_key=True)

 class B(models.Model):
mya = models.OneToOneField(A, primary_key=True)
text = models.TextField(default='Init')
 }}}

 In admin interface, I have used an inline to include B when
 changing/adding an A. Adding/Changing an A without touching the B inline
 results in A beeing saved, but not B. Changing the textfield from B into
 sth other than default and it works, but I want the default beeing saved
 too.

 Thanks!
 Jean

Comment:

 First, I fixed the description formatting.  Please use preview (and wiki
 format) to make sure things are readable before submitting.

 Replying to [comment:1 AdamG]:
 > My guess is that `BaseModelFormSet.save_existing_objects()` is skipping
 the form because `form.has_changed()` is False.

 Yes the problem is likely related to the fact that the form has not been
 changed, though I think it is the has_changed in save_new that is causing
 the issue here.  Thing is, if nothing has changed, how is the admin code
 supposed to figure out that a new item should be created?  I don't believe
 it is always the case that you'd want admin creating objects with all
 defaults (actually I'm pretty sure there was once a bug because admin did
 that).  I am not sure that the admin interface, as it currently exists,
 supports what is being asked for here.  There is currently no explicit
 "add this item" checkbox (as there is for delete), thus the admin has to
 figure out the right thing to do.  It does that now by seeing if anything
 has changed since the form was presented to the user.  If yes, then an
 object is added.  If no, then no new object is created.  I don't quite see
 how to support this use case, and also the case where you don't want all-
 default objects created (which is also valid), without a pretty
 significant change in the admin interface here.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #11807: Admin inlines onetoone related object not saved

2009-08-31 Thread Django
#11807: Admin inlines onetoone related object not saved
--+-
  Reporter:  neme...@twilightzone.lu  | Owner:  nobody  
  
Status:  new  | Milestone:  
  
 Component:  django.contrib.admin |   Version:  1.1 
  
Resolution:   |  Keywords:  admin inline 
onetoone save
 Stage:  Unreviewed   | Has_patch:  0   
  
Needs_docs:  0|   Needs_tests:  0   
  
Needs_better_patch:  1|  
--+-
Changes (by AdamG):

  * needs_better_patch:  => 1
  * component:  Uncategorized => django.contrib.admin
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 The attached patch against trunk adds a regression test that fails and
 shows the problem.

 Note that when the submitted value is not the default value, it's saved
 correctly, so `test_onetoone_pk_inline_changed` passes. My guess is that
 `BaseModelFormSet.save_existing_objects()` is skipping the form because
 `form.has_changed()` is False.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---