Monday, May 13, 2013

Reg: Delete Button is not removing the entry

Hi,

I have a form like as follows:


VolName      Desc      Status
------------       -------       --------

Vol1            Sample    Available


I have a created a delete button above this table. When I click delete, it says deleting Vol 1, but the entry is not removed. I have to reload the page to see the changes. I have pasted the code below. How would i make it to disappear without loading the page.


class DeleteVolume(tables.DeleteAction):
    data_type_singular = _("Volume")
    data_type_plural = _("Volumes")
    action_past = _("Scheduled deletion of")

    def delete(self, request, obj_id):
        obj = self.table.get_object_by_id(obj_id)
        name = self.table.get_object_display(obj)
        try:
            cinder.volume_delete(request, obj_id)
        except:
            msg = _('Unable to delete volume "%s". One or more snapshots '
                    'depending on it.')
            exceptions.check_message(["snapshots", "dependent"], msg % name)
            raise

    def allowed(self, request, volume=None):
        if volume:
            return volume.status in DELETABLE_STATES
       # return True

--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate