Please keep your replies on-list so others may benefit in the future.

On Thu, Jun 23, 2011 at 10:01 PM, Satyajit Sarangi <
writetosatya...@gmail.com> wrote:

> First of all , when I am doing this
> perm.table = ContentType.objects.get(app_label="OsmMap",model="Osm_Layers")
> I am getting a content type matching query doesnt exist error .
>

I personally don't ever use the contenttypes framework (at least not
directly), so I can't help you here.


>
> In another app , in its views . I have done this
>
> tab_id = 3
> this_user = request.user
>     user1= this_user.pk
>                 uperm = PermiLayer()
> a=uperm.objects.get(user_id__exact=pk,table_id_exact=tab_id)
> if a.permi == 3:
>        lcount = Osm_Layers()
>       lcount= Osm_Layers.objects.get(pk=tab_id)
>       form1 = ReadOnlyForm(initial={"geomcollection": lcount.geom_poly})
>
>
> What I am doing here is this , I am checking if the table_ id and the
> user_id that has logged in has a certain permission . Permission can be any
> number , and thus a certain user on a certain table can have 3 , 2 or/and 1
> as permission . Thus it would repeat itself . Thus , how do I query the db
> better than my present view . And also , what is the query set error?
>

If you are encountering any condition where data is repeating where it
shouldn't, then I'd say there is a fault in your logic.

Also, what do you mean by "what is the query set error"?


>
> On Fri, Jun 24, 2011 at 2:27 AM, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
>> **
>> 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 ?
>>
>>
>>
>>
>
>
> --
> *Satyajit Sarangi*
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to