Skip to content

Instantly share code, notes, and snippets.

@EdwardIII
Created March 6, 2013 21:45
Show Gist options
  • Save EdwardIII/5103374 to your computer and use it in GitHub Desktop.
Save EdwardIII/5103374 to your computer and use it in GitHub Desktop.
'OrderLineInline.fields' refers to field 'guests' that is missing from the form.
class OrderLineInline(admin.StackedInline):
model = OrderLine
readonly_fields = ('line_price',)
extra = 0
fields=('ticket','quantity', 'guests')
def guests(self, obj):
return obj.guest_set.join(', ')
class OrderAdmin(admin.ModelAdmin):
inlines = [ OrderLineInline ]
admin.site.register(Order, OrderAdmin)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment