Changes between Initial Version and Version 1 of Ticket #9992


Ignore:
Timestamp:
Jan 9, 2009, 5:34:59 AM (16 years ago)
Author:
Ramiro Morales
Comment:

(edited description)

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #9992 – Description

    initial v1  
    55Dear all,
    66
    7 I have difficulties with the get_profile to link my Profile class with
     7I have difficulties with the `get_profile` to link my `Profile` class with
    88the inbuilt User object.
    99
     
    1111shown below, or via the shell) is:
    1212
     13{{{
    1314---------------------------------------------------------------------------
    1415AttributeError                            Traceback (most recent call last)
     
    2425
    2526AttributeError: 'NoneType' object has no attribute '_default_manager'
    26 
    27 
    28 This indicates that models.get_model() does return None, but I don't know why.
    29 
    30 I have in settings.py:
     27}}}
     28
     29This indicates that `models.get_model()` does return `None`, but I don't know why.
     30
     31I have in `settings.py`:
     32{{{
    3133AUTH_PROFILE_MODULE = 'people.profile'
     34}}}
    3235which I believe is the right entry.
    3336
     
    4447
    4548
    46 mysite/People/models.py contains:
    47 
     49`mysite/People/models.py` contains:
     50{{{
    4851#-----------
    4952from django.contrib.auth.models import User
     
    5760        pass
    5861#-----------
    59 
    60 The corresponding view (which fails) is in mysite/People/views.py:
     62}}}
     63
     64The corresponding view (which fails) is in `mysite/People/views.py`:
     65{{{
    6166#-----------
    6267from django.contrib.auth.models import User
     
    6974        #at this point we get an error, equivalent to shell example
    7075#-----------
    71 
    72 The mysite/settings.py reads
    73 
     76}}}
     77The `mysite/settings.py` reads
     78{{{
    7479#-----------
    7580# Django settings for mysite project.
     
    158163)
    159164#------------
    160 
    161 and the url.py is
     165}}}
     166and the `url.py` is
     167{{{
    162168#------------
    163169from django.conf.urls.defaults import *
     
    172178)
    173179#------------
    174 
     180}}}
    175181
    176182The error can be triggered by viewing
     
    179185
    180186or by running the shell example shown here:           
    181    
     187   
     188{{{
    182189phi:mysite fangohr$ python manage.py shell
    183190Enthought Python Distribution -- http://code.enthought.com
     
    212219
    213220In [4]:
    214 
     221}}}
    215222
    216223
     
    226233
    227234PS Version:
    228 
     235{{{
    229236phi:mysite fangohr$ python manage.py --version
    2302371.0.2 final
    231 
     238}}}
    232239PPS In the database for this example, the admin user is 'admin' and
    233240the password is 'admin' -- in case anybody wants to play with that.
     
    236243Solution (Karen Tracey):
    237244
    238 (Thanks for the very detailed question.) I think you have found a documentation bug.  I do not believe the 'people' part of that should be normalized to lower case.  It is not normalized to lower case in INSTALLED_APPS, and I don't think it should be normalized to lower case here.  Since you have a capital P in People for your directory name, try 'People.profile'.
    239 
    240 Karen
    241 
    242 Note: Changing people.profile to People.profile solves the problem.
     245> (Thanks for the very detailed question.) I think you have found a
     246> documentation bug.  I do not believe the `'people'` part of that
     247> should be normalized to lower case.  It is not normalized to lower
     248> case in `INSTALLED_APPS`, and I don't think it should be normalized
     249> to lower case here.  Since you have a capital P in People for your
     250> directory name, try `'People.profile'`.
     251>
     252>
     253> Karen
     254
     255Note: Changing `people.profile` to `People.profile` solves the problem.
    243256
    244257
     
    248261Related documentation: http://docs.djangoproject.com/en/dev/topics/auth/#auth-profiles
    249262
    250 Here it says under 1.: "The (normalized to lower-case) name of the application in which the user profile model is defined (in other words, an all-lowercase version of the name which was passed to manage.py startapp to create the application)."
     263Here it says under 1.: "The (normalized to lower-case) name of the application in which the user profile model is defined (in other words, an all-lowercase version of the name which was passed to `manage.py startapp` to create the application)."
    251264
    252265This is wrong.
Back to Top