Sunday, May 1, 2011

Re: Using User.add_to_class

First of all, I'm a noob.

But why not using a custom User model altogether? Such as UserProfile with an FK to auth User and run the checks against that in your app? This seems to be like the solution with less maintenance overhead.


Sincerely,
André Terra (airstrike)


On Fri, Apr 29, 2011 at 12:03 AM, Venkatraman S <venkat83@gmail.com> wrote:
Resending :



On Wed, Apr 27, 2011 at 4:13 PM, Venkatraman S <venkat83@gmail.com> wrote:
Hi,

In my app, i have many functions added to the User class using User.add_to_class ; these are basically the functions that restrict the objects that can be viewed by the user during his session with the app. The functions are present in __init__.py in my project.

My Q : is this a good paradigm to do things? i.e, restricting the user's workspace. Or is it better that i do the DB queries in my views - apply filter on the queries there.
Which is a better model and would scale?(and also be easier if i implement caching in the near future).

IMHO, i find User.add_to_class to be extremely useful and the code is much easier to maintain; but since this is a paradigm Q, i would let the more experienced answer this.

-Venkat
http://blizzardzblogs.blogspot.com/

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment