I have an intersection/through table being used as an inline in the django admin. The inline has the foreign key to the other model listed as a drop down menu. I am able to make the field read only by setting the readonly_fields variable, but wish to allow addition of new foreign key objects by adding. So with the example below I'd like to be able to add Building_Room rows via the inline, just not be able to choose from any existing Room keys without clicking the '+' and adding a new one via the Room pop up admin screen. Will I have to do this via custom template work? Thanks much.
models.py
class Building(models.Model):
rooms = models.ManyToManyField('Room', null=True, through="Building_Room")
...
class Room(models.Model):
...
class Building_Room(models.Model):
building = models.ForeignKey(Building)
room = models.ForeignKey(Room)
admin.py
class Building_Room_Inline(admin.TabularInline):
model = Building_Room
readonly_fields = ('building',)
...
class Building_Admin(admin.ModelAdmin):
inlines = (Building_Room_Inline,)
...