On 18/12/2015 9:02 PM, Andreas Kuhne wrote:
Hi,
Are you working in django admin and using the delete checkbox to delete
a child record?
Yes
If so, it is not a javascript event, but it is handled by when you save
to the parents form (it's a formset with child forms). I would follow
where the django code stops executing.
Ok. I think I found the probrlem.
'''
def save_formset(self, request, form, formset, change):
""" this updates the related records when they change """
instances = formset.save(commit=False)
for instance in instances:
instance.modified_by = request.user
instance.save()
formset.save_m2m()
'''
Commenting this method out in admin.py enabled deletion. Assuming saving
the instance prevents deletion, I tried
for instance in instances:
if not instance in self.deleted_objects:
instance.modified_by = request.user
instance.save()
... but that didn't do anything.
Might have to skip adding request.user to modified objects.
Thanks again for any advice
Cheers
Mike
Haven't found it yet but I have a question about django/forms/models.py
748----self.deleted_objects.append(obj)
749----if commit:
750--------obj.delete()
Regards,
Andréas
2015-12-18 10:20 GMT+01:00 Mike Dewhirst <[email protected]
<mailto:[email protected]>>:
Forgot to mention - Django 1.8, Python 2.7 and 3.4, Postgres 9.1 and
9.3, Apache 2.2 and the dev server
I have been digging a little and think this is a javascript
initiated event. I am not comfortable with javascript so my
uncertainty has just doubled.
Thanks very much for any direction
Cheers
Mike
On 17/12/2015 6:41 PM, Mike Dewhirst wrote:
I'm having trouble debugging a failed child record Delete. That
is the
Delete [x] checkbox being ticked does not delete the child record.
It is obviously something to do with my bad but I'm not sure
where to
start.
Any hints?
Thanks
Mike
--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected]
<mailto:django-users%[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/5673CFCF.70707%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CALXYUbmbJ%2B-0bATpHDscunyo6r1CwK7KGAEWvTQk9mxpQFpuiA%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CALXYUbmbJ%2B-0bATpHDscunyo6r1CwK7KGAEWvTQk9mxpQFpuiA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/5675F7DA.5030109%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.