#23754: DisallowedModelAdminToField when using get_inline_instances()
-------------------------------------------+------------------------
Reporter: timgraham | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.4
Severity: Release blocker | Keywords:
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
As reported in the comments of #23552:
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"
--
Ticket URL: <https://code.djangoproject.com/ticket/23754>
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/052.f70342808ddd0267880b91e4bd5c0298%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.