Re: I need help
I fix the error.
Thank you for your time.
The error was caused for a bad access to delete function. Thanks againg.
Best Regards
On Tue, Feb 19, 2013 at 5:55 PM, Russell Keith-Magee <russell@keith-magee.com> wrote:
--On Wed, Feb 20, 2013 at 6:52 AM, Carlos Aguilar <darkangel51@gmail.com> wrote:
I am trying to use the User model outside of django app, but without successful.This is my imports section:from django.core.management import setup_environfrom htdjango import settingssetup_environ(settings)from django.contrib.auth import get_user_modelI am trying many things but right now I am receiving this error:Traceback (most recent call last):File "htuser.py", line 539, in <module>user.delete()File "htuser.py", line 99, in deletedjango_user.objects.delete()File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 232, in __get__raise AttributeError("Manager isn't accessible via %s instances" % type.__name__)AttributeError: Manager isn't accessible via HTDjangoUser instancesYou've provided code, but not the code that is actually raising the error (i.e., htuser.py). However, the error message does tell you exactly what you're doing wrong -- you're attempting to access a manager, when what you have is an instance.Your code will be doing something like this:> myUser = User.objects.get(username='foo')> myUser.objects.all()myUser is an *instance* of User. The ".objects" attribute, representing the manager, exists for internal reasons, but you can't use it - you're trying to access a manager on an instance.> User.objects.all()*would* be legal -- in this case, you're accessing the manager on the *class*, not the instance.Looking at your stack trace, the problem is either on line 539 or line 99 of htuser.py, where you've switched between working with an instance and working with a model. You'll have to work out for yourself what the fix is.Yours,Russ Magee %-)
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Carlos Aguilar
Consultor Hardware y Software
DWD&Solutions
http://www.dwdandsolutions.com
http://www.houseofsysadmin.com
Cel: +50378735118
Cel: +50378735118
USA: (301) 337-8541
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home