Hey Guys:
Wondering if I can get some advice/help.
I'm trying to alter the admin in a simple way so that instead of the
first column (by default) be linked to the change screen I want to
create a callable property and use that as the change screen link.
Here is my code:
class SubmissionAdmin(admin.ModelAdmin):
list_display = ('full_name', 'message', 'submit_ip', 'edit')
list_display_links = ('edit',)
def full_name(self, obj):
return ('%s %s' % (obj.first_name, obj.last_name))
full_name.short_description = 'Name'
def edit(self, obj):
return('Edit')
edit.short_description = 'Edit'
def save_model(self, request, obj, form, change):
obj.submit_ip = request.META['REMOTE_ADDR']
obj.save()
I have a callable that just returns a string 'Edit' that I want to use
as the link in the admin. But django apparently wont let me do this
with 'list_display_links' even though it does let you do it with
'list_display'
I know I could probably create this in the model itself, but that
seems unintuitive to me since all I'm trying to do is alter the admin
display.
Thoughts?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---