Changeset 292
- Timestamp:
- 01/14/08 20:38:20 (5 years ago)
- Files:
-
- 1 modified
-
elixir/trunk/elixir/ext/list.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
elixir/trunk/elixir/ext/list.py
r289 r292 83 83 __all__ = ['acts_as_list'] 84 84 __doc_all__ = [] 85 86 87 def get_entity_where(instance): 88 clauses = [] 89 for column in instance.table.primary_key.columns: 90 instance_value = getattr(instance, column.name) 91 clauses.append(column==instance_value) 92 return and_(*clauses) 85 93 86 94 … … 135 143 # move this item to the max position 136 144 self.table.update( 137 self.table.c.id == self.id,145 get_entity_where(self), 138 146 values={ 139 147 self.table.c.position : select( … … 158 166 159 167 # move this item to the first position 160 self.table.update( self.table.c.id == self.id).execute(position=1)168 self.table.update(get_entity_where(self)).execute(position=1) 161 169 162 170 … … 184 192 185 193 # update this item's position to the desired position 186 self.table.update( self.table.c.id==self.id).execute(position=position)194 self.table.update(get_entity_where(self)).execute(position=position) 187 195 188 196
