thanks Pankaj for replay my question so quickly. :)

I already add this code in models.py
code as below.
I place it under path "mysite/accounts/models.py"
--------------------------------models.py--------------------------------------------
from django.db import models

# Create your models here.
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from userena.models import UserenaBaseProfile

class MyProfile(UsernaBaseProfile):
  user = models.OneToOneField(User,
                              unique=True,
                              verbose_name=_('user'),
                              related_name='my_profile')
  favourite_snack = models.CharField(_('favourite snack'),
                                     max_length=5)

So many thanks for u,
Felix Zhao


On Tue, Feb 19, 2013 at 3:10 PM, Pankaj Singh <[email protected]> wrote:

> Hey,
>
> You need to import UserenaBaseProfile in your models.py before defining
> MyProfile class.
>
> from userena.models import UserenaBaseProfile
>
> http://docs.django-userena.org/en/latest/installation.html#profiles
>
> Sincerely,
> Pankaj Singh
> http://about.me/psjinx
>
>
> On Tue, Feb 19, 2013 at 12:36 PM, Zhao Quan <[email protected]> wrote:
>
>> Hi all,
>>
>> I fish for django.
>> So, I want to use some code to handle use login and registion issue.
>> I find the code name "django-userena"
>>
>> But, after I follow the guide to setup.
>> http://docs.django-userena.org/en/latest/installation.html
>>  I get exception like this: NameError: name 'UsernaBaseProfile' is not
>> defined
>>
>> ------------------------detial info as below
>> ---------------------------------
>>
>> ~/djcode/mysite$ ./manage.py check_permissions
>> Traceback (most recent call last):
>>   File "./manage.py", line 10, in <module>
>>     execute_from_command_line(sys.argv)
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
>> line 443, in execute_from_command_line
>>     utility.execute()
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
>> line 382, in execute
>>     self.fetch_command(subcommand).run_from_argv(self.argv)
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
>> line 196, in run_from_argv
>>     self.execute(*args, **options.__dict__)
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
>> line 231, in execute
>>     self.validate()
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
>> line 266, in validate
>>     num_errors = get_validation_errors(s, app)
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py",
>> line 30, in get_validation_errors
>>     for (app_name, error) in get_app_errors().items():
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
>> 158, in get_app_errors
>>     self._populate()
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
>> 64, in _populate
>>     self.load_app(app_name, True)
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
>> 88, in load_app
>>     models = import_module('.models', app_name)
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line
>> 35, in import_module
>>     __import__(name)
>>   File "/home/quanzhao/djcode/mysite/accounts/models.py", line 8, in
>> <module>
>>     class MyProfile(UsernaBaseProfile):
>> NameError: name 'UsernaBaseProfile' is not defined
>>
>>  --
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to