I'd like to vet this through the users here before submitting a bug report.
Per the tutorial, all of my models have a defined __unicode__(self) which returns a string. The code is below, but here's the scenario: 1. I add a 'Device' with associated 'Interface'. 2. I edit the 'Device', with the inline 'Interface', add another 'Interface', and save. 3. I edit the 'Device', with the inline 'Interfaces', select the checkbox to delete the interface I just added, and click save, which results in the interface actually being deleted, but the following error: ... File "/hostdb/lib/python2.7/site-packages/django/utils/encoding.py" in force_unicode 71. s = unicode(s) Exception Type: TypeError at /admin/hostdb/device/MM89999/ Exception Value: coercing to Unicode: need string or buffer, NoneType found The POST data shows: ... interface_set-1-primary u'on' interface_set-1-hostname u'foo.our.org' interface_set-1-ip_address u'10.1.1.4' interface_set-1-mac_address u'somestring' interface_set-1-device u'MM89999' ... interface_set-0-DELETE u'on' interface_set-0-ip_address u'10.1.1.1' interface_set-0-hostname u'test.our.org' interface_set-0-device u'MM89999' interface_set-0-mac_address u'' #------------------------------------------------------------------ # myapp/models.py #------------------------------------------------------------------ class Interface(models.Model): hostname = models.CharField('Hostname', primary_key=True, max_length=80) ip_address = models.IPAddressField('IP Address', unique=True) mac_address = models.CharField('MAC Address', max_length=40, blank=True) primary = models.BooleanField('Primary', default=False) # the following on_delete may not be the right thing to do device = models.ForeignKey('Device', null=True, blank=True, verbose_name='Associated device', on_delete=models.DO_NOTHING) def __unicode__(self): return self.hostname class Device(models.Model): propertyno = models.CharField('Property Number', max_length=10, primary_key=True) def primary_hostname(self): for i in self.interface_set.all(): if i.primary: return i.hostname return 'UNKNOWN' def __unicode__(self): h = self.primary_hostname() if h == 'UNKNOWN': return self.propertyno return h #------------------------------------------------------------------ # myapp/admin.py #------------------------------------------------------------------ from hostdb.models import Device, Interface class InterfaceInline(admin.TabularInline): model = Interface extra = 0 class DeviceAdmin(admin.ModelAdmin): inlines = [InterfaceInline] admin.site.register(Device, DeviceAdmin) admin.site.register(Interface) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.