Re: newbie needs to copy a record in admin to a new record

2013-01-11 Thread frocco
Thank you [code] def make_copy(modeladmin, request, queryset): for obj in queryset: obj.pk = None obj.object_name = "dup" obj.save() make_copy.short_description = "Copy selected records" [/code] On Friday, January 11, 2013 10:53:02 AM UTC-5, Brad Pitcher wrote: > > I t

Re: newbie needs to copy a record in admin to a new record

2013-01-11 Thread Brad Pitcher
I think what should work well for your use case is an admin action: https://docs.djangoproject.com/en/1.4/ref/contrib/admin/actions/ You can write code for a copy action in admin.py. This will add a "copy" item to the dropdown in the list view, so you can select any number of list items and copy

newbie needs to copy a record in admin to a new record

2013-01-11 Thread frocco
Hello, I am just learning django and want to allow a user in admin to copy a record from the list to create a new record and make changes. This will prevent having to type similar data. How do I add a link to the admin list? where do I put code to dup the record? Thank you -- You received th