You have started from the beginning. Take a look at my very first reply in
this thread. Remove 'areacode' and 'number' fields from your MemberAdmin.
Let them be available from PhoneInline and AddressInline. You will be see
them on the same admin page, just in other visual block where inline forms
display.

Sure, if you don't like such things, you are always up to extend admin
template for exactly this view and output anything you like.

On Sun, May 8, 2011 at 7:19 AM, Eiji Kobayashi <itoshinom...@gmail.com>wrote:

> Hi Oleg,
>
> Thanks for your patience. I'm pretty sure I DID miss something like
> you said. Here's my admin.py, with the modifications you suggested:
>
> # admin.py
> from django.contrib import admin
> from django.contrib.auth.models import User
> from models import Member, Address, Phone
>
> class PhoneInline(admin.StackedInline):
>  model = Phone
>  can_delete = True
>  extra = 0
>   fields = ( 'areacode', 'number')
>
> class AddressInline(admin.StackedInline):
>  model = Address
>  can_delete = True
>  extra = 0
>   fields = ( 'addresstype', 'address', 'city', 'state', 'postal_code')
>
> class MemberAdmin(admin.ModelAdmin):
>  inlines = [ PhoneInline, AddressInline ]
>  fieldsets = (
>    (None, {
>        'fields': ( 'first_name', 'middle_name', 'last_name',
> 'areacode', 'number' )
>    })
>    )
>
> admin.site.register(Member, MemberAdmin)
>
> The actual error I get is:
>
> ImproperlyConfigured at /admin/
> 'MemberAdmin.fieldsets[0][1]['fields']' refers to field 'areacode'
> that is missing from the form.
>
> When I add the all_phones function in the models.py and define the
> list_display like you suggested, I get this error:
>
> TemplateSyntaxError at /admin/account/member/
> Caught OperationalError while rendering: (1054, "Unknown column
> 'account_phone.areacode' in 'field list'")
>
> There must be a simpler way to just edit the primary model and its
> related models in the admin, no?
> Thanks!
>
> Eiji
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to