Merge "Makes sure ajax-updated rows still get correct actions allowed."
This commit is contained in:
		@@ -53,9 +53,6 @@ class BaseAction(html.HTMLElement):
 | 
				
			|||||||
        return True
 | 
					        return True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _allowed(self, request, datum):
 | 
					    def _allowed(self, request, datum):
 | 
				
			||||||
        """ Default allowed checks for certain actions """
 | 
					 | 
				
			||||||
        if isinstance(self, BatchAction) and not self.table.data:
 | 
					 | 
				
			||||||
            return False
 | 
					 | 
				
			||||||
        return self.allowed(request, datum)
 | 
					        return self.allowed(request, datum)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def update(self, request, datum):
 | 
					    def update(self, request, datum):
 | 
				
			||||||
@@ -427,6 +424,13 @@ class BatchAction(Action):
 | 
				
			|||||||
                                           self._conjugate('plural'))
 | 
					                                           self._conjugate('plural'))
 | 
				
			||||||
        super(BatchAction, self).__init__()
 | 
					        super(BatchAction, self).__init__()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def _allowed(self, request, datum=None):
 | 
				
			||||||
 | 
					        # Override the default internal action method to prevent batch
 | 
				
			||||||
 | 
					        # actions from appearing on tables with no data.
 | 
				
			||||||
 | 
					        if not self.table.data and not datum:
 | 
				
			||||||
 | 
					            return False
 | 
				
			||||||
 | 
					        return super(BatchAction, self)._allowed(request, datum)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _conjugate(self, items=None, past=False):
 | 
					    def _conjugate(self, items=None, past=False):
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        Builds combinations like 'Delete Object' and 'Deleted
 | 
					        Builds combinations like 'Delete Object' and 'Deleted
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user