Thursday, June 23, 2011

Re: What would be a better views.py code to achieve this particular task .

You're going to have to explain this a lot better, because I really did not understand what you mean.

At a *GUESS*, are you trying to prevent against db save race conditions or something??

Please clarify.

Cal

On 23/06/2011 20:07, Satyajit Sarangi wrote:
This is my models.py of a different app .       class PermiLayer(models.Model):         user = models.ForeignKey(User)         table = models.ForeignKey(ContentType)         permi = models.IntegerField()   In another app's views , I am accessing a form that has given me a username .  I have to check in PermiLayer model if the username along with the table id match in it and return back the data in permi .  The problem here is , User + table can be present multiple times , as in the same user and and table id .  What I am doing in my code is , do an object.get.all with a filter of the username and table id that I have on Permilayer . But , object.get.all , as I have read , might just freeze my database , or slow it down considerably . Is there a faster/better way to do it ?  

No comments:

Post a Comment