﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
11875	ForeignKey field with blank=True and null=True in list_display breaks admin	Deniz Dogan	Daniel Gonzalez Gasull	"When you have a model with a `ForeignKey` to another model with `blank=True` and `null=True` and use the foreign key in `list_editable` and the value is indeed ""null"" (i.e. no relation exists), the admin interface breaks with the following message:

{{{
Caught an exception while rendering: invalid literal for int() with base 10: ''
}}}

This is the code to reproduce it:

{{{
#!python
# models.py

from django.db import models

class Brand(models.Model):
    name = models.CharField(max_length=32, blank=True)

class Bicycle(models.Model):
    brand = models.ForeignKey(Brand, blank=True, null=True)
    kind = models.CharField(max_length=32)


#admin.py

from django.contrib import admin
from eplister.hello.models import *

class BrandAdmin(admin.ModelAdmin):
    model = Brand

class BicycleAdmin(admin.ModelAdmin):
    model = Bicycle
    list_display = ('kind', 'brand', )
    list_display_links = ('kind', )
    list_editable = ('brand', )

admin.site.register(Brand, BrandAdmin)
admin.site.register(Bicycle, BicycleAdmin)
}}}"		closed	contrib.admin	dev		worksforme	foreignkey admin list_editable	deniz.a.m.dogan@…	Accepted	0	0	0	0	0	0
