#25587: Django fails, when trying to save object "as new" with inlines objects 
and
form validation errors.
-------------------------------+--------------------------------------
     Reporter:  user0007       |                    Owner:  nobody
         Type:  Bug            |                   Status:  new
    Component:  contrib.admin  |                  Version:  1.8
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------

Comment (by user0007):

 Replying to [comment:4 timgraham]:
 > Could you please provide a sample project or a minimal set of models to
 reproduce the issue?

 Sure.

 models.py:

 {{{
 class User(models.Model):
     first_name = models.CharField(max_length=255)


 class Project(models.Model):
     user = models.ForeignKey(User)
     name = models.CharField(max_length=255)

 class Collaborator(models.Model):
     email = models.Email()
     user = models.ForeignKey(User)
     project = models.ForeignKey(Project)
 }}}

 admin.py:

 {{{
 class CollaboratorAdmin(admin.TabularInline):
     model = Collaborator
     extra = 1
     raw_id_fields = ('user',)

 class ProjectAdmin(admin.ModelAdmin):
     inlines = [CollaboratorAdmin]
     raw_id_fields = ('user',)
     save_as = True

 admin.site.register(Project, ProjectAdmin)
 admin.site.register(User)
 }}}

 Follow those steps:

 1. Add ''Project'' object with 2 inlines objects.
 2. Go to edit form.
 3. Clear project's "name" input and click "Save as new" button.
 4. Click "Save and continue editing".
 5. Booom :-)

 Tested on Django 1.6, 1.7, 1.8

--
Ticket URL: <https://code.djangoproject.com/ticket/25587#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.d0efff2a90e97d67cc135bc988e55ceb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to