El mié, 10-03-2010 a las 17:28 -0500, Shawn Milochik escribió:
> I think you missed my point, or I explained it badly.
>
> 1. In makeOrder, change i.save() to i.save(reorder = False).
>
> 2. Change the save function to something like the following
> (untested):
>
> def save(self, *args, **kwargs
I think you missed my point, or I explained it badly.
1. In makeOrder, change i.save() to i.save(reorder = False).
2. Change the save function to something like the following (untested):
def save(self, *args, **kwargs):
do_ordering = kwargs.pop('reorder', True)
super(Subject, s
El mié, 10-03-2010 a las 15:37 -0500, Shawn Milochik escribió:
> Every time you save(), you call makeOrder(). Every time you run
> makeOrder(), you call save(). You've introduced an infinite loop.
> Well, infinite until Python decides enough is enough.
>
Yes right.
But I need to reorder them all
Or more specifically, why exactly do you want to reorder them all at
every Subject .save()? And what exactly do you use the values in
'order' field for?
On Mar 10, 11:46 pm, Beres Botond wrote:
> Even if we ignore the infinite loop, selecting and updating every
> single instance of Subject at eve
Even if we ignore the infinite loop, selecting and updating every
single instance of Subject at every save() of a Subject, is horribly
wrong and inefficient on many levels.
Exactly what kind of functionality/logic were you trying to implement?
On Mar 10, 10:32 pm, Ali Rıza Keleş wrote:
> Hi all,
Every time you save(), you call makeOrder(). Every time you run makeOrder(),
you call save(). You've introduced an infinite loop. Well, infinite until
Python decides enough is enough.
One simple possibility is to add an optional argument with a default of True to
the save() override that determ
Hi all,
I want to override saving of one of my models.
After saving any record, I am trying to reorder them all.
class Subject(models.Model):
slug = models.SlugField(db_index=True, unique=True)
name = models.CharField(max_length="120")
order = models.CharField(blank = True, max_leng
7 matches
Mail list logo