Monday, February 18, 2013

Re:

Right. 'UsernaBaseProfile' should be 'UserenaBaseProfile'.

Sincerely,
Pankaj Singh


On Tue, Feb 19, 2013 at 12:53 PM, Zhao Quan <felixz2010@gmail.com> wrote:
thanks I resolve that issue,
seems the parameter miss a 'e'.


On Tue, Feb 19, 2013 at 3:15 PM, Zhao Quan <felixz2010@gmail.com> wrote:
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 <ps.jinx@gmail.com> 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


On Tue, Feb 19, 2013 at 12:36 PM, Zhao Quan <felixz2010@gmail.com> 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.
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 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.
 
 

--
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.
 
 


--
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.
 
 

--
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.
 
 

No comments:

Post a Comment