Opened 10 years ago

Closed 10 years ago

#23552 closed Bug (duplicate)

Bad request (Error 400) on almost all inline adding calls

Reported by: Maxime BOGUTA Owned by: nobody
Component: contrib.admin Version: 1.7
Severity: Release blocker Keywords: inline, error, http, response, 400
Cc: AMORCE Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hello,

I'm forwarding my Django setup to 1.7 and having a check for incompatibilites/bugs from my setup previously on 1.6.

Working on a test setup, I found out most of the adding inline (green crosses) models now retrieve a "Bad Request (400)" error. The URL seems to have changed from 1.6, but this seems to work with some inline calls (found one working and actually displaying the adding form).

Nothing on logs from Django, and Debug is set to True.

Cutting the URL from the slash '/' after 'add' just before the GET arguments (to_field=xxx&popup=1) brings the page up.

This is blocking my deployment, and after being investigating about this bug for half a day now I can't manage to find fix/info about it.

Attachments (1)

error.png (190.4 KB ) - added by Maxime BOGUTA 10 years ago.
Error screenshot and reproducing steps.

Download all attachments as: .zip

Change History (5)

by Maxime BOGUTA, 10 years ago

Attachment: error.png added

Error screenshot and reproducing steps.

comment:1 by Simon Charette, 10 years ago

Component: HTTP handlingcontrib.admin
Resolution: duplicate
Status: newclosed

I'm pretty confident this a duplicate of #23431.

Can you confirm your issues are solved on the stable/1.7.x branch? (pip uninstall django && pip install git+git://github.com/django/django.git@stable/1.7.x.

The fix should be part of the 1.7.1 release.

comment:2 by Maxime BOGUTA, 10 years ago

Yep! Those issues are solved by your recommandations, everything is working on again.

If 1.7.1 is not to be released shortly, it has to be fixed in some other way as this is really release blocking.

Thank you!

comment:3 by AMORCE, 10 years ago

Cc: AMORCE added
Resolution: duplicate
Status: closednew

Hi,

This bug still occur with 1.7.1 when inlines are declared using get_inline_instances

models.py

class Invoice(models.Model):
    ...

class Payment(models.Model):
    ...

class InvoicePayment(models.Model):
    payment = models.OneToOneField(Payment)
    invoice = models.ForeignKey(Invoice)

admin.py:

class InvoicePaymentInline(admin.StackedInline):
    model = InvoicePayment
    extra = 1


class InvoiceAdmin(admin.ModelAdmin):
    #Using sample code from https://docs.djangoproject.com/en/1.7/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_inline_instances
    def get_inline_instances(self, request, obj=None):
        return [inline(self.model, self.admin_site) for inline in [InvoicePaymentInline]]


# Register your models here.
admin.site.register(Invoice, InvoiceAdmin)
admin.site.register(Payment, )

In admin, from invoice change_form, click on "+" button next payment in inlines display popup with "bad request 400"

comment:4 by Tim Graham, 10 years ago

Resolution: duplicate
Status: newclosed

Thanks for the report, I have moved this to a separate issue for clarity: #23754.

Note: See TracTickets for help on using tickets.
Back to Top