chr
unread,Aug 28, 2008, 4:34:55 AM8/28/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
hi. i've got a model like this:
class Inventory(models.Model):
barcode = models.PositiveIntegerField(unique=True)
parent = models.ForeignKey('self', to_field='barcode', blank=True,
null=True)
name = models.CharField(blank=False)
and i get:
>>> i = Inventory.objects.get(barcode=115716)
>>> i
<Inventory: Apple Mighty Mouse>
>>> i.parent
<Inventory: Apple iMac>
which is fine. whereas in the admin the select-widget will have the
item selected whose id accidentally matches the barcode. i.e. the
values in the select-widget aren't the values from barcode but the pk.
<option value="247">Apple Mighty Mouse</option>
i couldn't find this behaviour in the admin documented anywhere.
so, is the bug in my model, the lack of documentation or the admin?
many thanks in advance.
cheers. chr