Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » User model being included by default [RSS Feed]

#1 Jan. 7, 2011 06:37:49

Subhranath C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

User model being included by default


Firstly, I think this should be posted to the
django-us...@googlegroups.comgroup instead.
So, just make sure to post queries on using Django to there only.


Coming back to your question.
If you are using your own user model then, I hope you are using the not
using the import
'from django.contrib.auth.models import User' when try to '
User.objects.anymethod()'.
Make sure that you are using something like 'from yourapp.models import
User'.
And also make sure that the custom db tables for your app is properly
synced.

And when using some custom authentication backend in your application, I
think you'll probably want to specify and use it in your settings.py
as something probably like the following:
AUTHENTICATION_BACKENDS = (
'yourapp.backends.YourCustomBackend',
)

So, you'll also need to have the custom backend written too.

Thanks,
Subhranath Chunder.

On Fri, Jan 7, 2011 at 3:15 AM, Antony Vennard <antony.venn...@gmail.com>wrote:

> Hello all,
>
> For various reasons a client of mine requested that, other than using a
> framework of their choice, I implement an authentication system
> following their spec. I used Django and implemented my own app which
> contains the usual models.py which implements a user object and so on.
>
> Django has been updated via my package manager several times since I
> last tested my code. I've now come back to that and what was previously
> working is breaking like so:
>
> DatabaseError at /
> column auth_user.first_name does not exist
> LINE 1: SELECT "auth_user"."id", "auth_user"."username", "auth_user"...
>
> This happens when I import my own models.py and try to
> User.objects.anymethod()
>
> Now, my model "User" doesn't contain the same fields as Django's
> obviously, so the conclusion is that Django's User model is being
> included when I've not asked it to be.
>
> Relevant parts from Settings.py:
>
> TEMPLATE_LOADERS = (
> 'django.template.loaders.filesystem.Loader',
> 'django.template.loaders.app_directories.Loader',
> 'django.template.loaders.eggs.Loader',
> )
>
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> )
>
> ROOT_URLCONF = 'Testbed.urls'
>
> TEMPLATE_DIRS = (
> "/var/www/Django/Testbed/testapp/templates",
> "/var/www/Django/Testbed/authadmin/templates",
> )
>
> AUTHENTICATION_BACKENDS = ('')
>
> TEMPLATE_CONTEXT_PROCESSORS = (
> "vxd.auth.contexts.Authentication",
> )
>
> INSTALLED_APPS = (
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'reversetag',
> 'markitup',
> 'vxd.auth',
> 'Testbed.authadmin',
> 'Testbed.testapp',
> )
>
> Can anyone please explain what's changed?
>
> Likewise, I get various strange errors on a similar project using my
> system when I try to access the request.session key.
>
> An alternative is a project-wide rename; still, this isn't ideal.
>
> Thanks,
>
> A
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To post to this group, send email to django-develop...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-developers+unsubscr...@googlegroups.com<django-developers%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
>http://groups.google.com/group/django-developers?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-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » User model being included by default [RSS Feed]

Board footer

Moderator control

Enjoy the 21st of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support