I am looking for ways to dynamically update the inline entries using ajax. i.e. as the user selects an item from the dropdown box, the associated input fields can be populated with data.
The views.py part for ajax should be straightforward. But one problem for me is how to get the names of dropdown boxes in js, which can be added on the fly.
Below are the models.py and admin.py:
models.py
class Tshirt:
designer = CharField()
default_wording = CharField()
class Order:
date = DateField()
class Order_item:
order = ForeignKey(Order, related_name='order')
tshirt = ForeignKey(Tshirt)
wording = CharField()
admin.py
class Order_Inline(TabularInline):
model = Order_item
fk_name = 'order'
class Order_Admin(ModelAdmin):
inlines = [Order_Inline,]