Changes between Initial Version and Version 1 of Ticket #29981
- Timestamp:
- Nov 23, 2018, 1:17:15 PM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #29981
- Property Triage Stage Unreviewed → Accepted
- Property Summary invalid_choice error when changing InlineModel with a OneToOne relation via to_field → "Please correct the error below." (with no errors displayed) when changing an inline that has a one-to-one relation to the parent that uses to_field
-
Ticket #29981 – Description
initial v1 12 12 title = models.CharField(max_length=255, blank=True, null=True) 13 13 14 class Meta:15 verbose_name_plural = 'Entries'16 17 14 class EntryDetail(models.Model): 18 15 entry = models.OneToOneField( … … 23 20 ) 24 21 description = models.TextField(blank=True, null=True) 25 26 class AnotherEntryDetail(models.Model):27 entry = models.OneToOneField(28 Entry,29 primary_key=True,30 on_delete=models.CASCADE31 )32 otherdescription = models.TextField(blank=True, null=True)33 22 }}} 34 35 23 36 24 admin.py … … 38 26 {{{ 39 27 from django.contrib import admin 40 from .models import Entry, EntryDetail , AnotherEntryDetail28 from .models import Entry, EntryDetail 41 29 42 30 class EntryDetailInline(admin.StackedInline): 43 31 model = EntryDetail 44 32 45 class AnotherEntryDetailInline(admin.StackedInline):46 model = AnotherEntryDetail47 48 33 @admin.register(Entry) 49 34 class EntryAdmin(admin.ModelAdmin): 50 inlines = [ 51 EntryDetailInline, 52 AnotherEntryDetailInline 53 ] 35 inlines = [EntryDetailInline] 54 36 55 37 def get_readonly_fields(self, request, obj=None): … … 63 45 }}} 64 46 65 66 **Expected behavior:**67 68 In the admin:69 * add an Entry70 * fill slug and "Another entry detail" description71 * save72 * (change "Another entry detail" description)73 * **save**74 75 76 47 **Steps to reproduce the bug:** 77 48 78 49 In the admin: 79 50 * add an Entry 80 * fill slug and "Entry detail" description 51 * fill slug, title, and "Entry detail" description 52 * save and continue editing 53 * change "Entry detail" description 81 54 * save 82 * (change "Entry detail" description) 83 * **save** 84 * Error message in admin: "Please correct the error below." 85 55 * Error message in admin: "Please correct the error below." (with no errors listed). `formset[0].errors` is `[{'entry': ['The inline value did not match the parent instance.']}]` which comes from `InlineForeignKeyField` value is `aaa` and `orig` is `1`. 86 56 87 57 **Workaround:** … … 110 80 formset = EntryDetailFormSet 111 81 }}} 112 113 114 ''Sorry for the confusing ticket-title, i couldn't come up with something better.''