Hi all,

I'm trying to write a model to extend the standard Django user model,
which will add (among other things) the ability to have a list of users
recorded as your friends (like Flickr, or Digg).

The model looks like this (stripped down to just the relevant fields)

----------------------
from django.db import models
from django.contrib.auth.models import User

class UserProfile(models.Model):
        """Extra fields to add to the User Model"""

        User           = models.OneToOneField(User)
        Friends        = models.ManyToManyField(User)

----------------------

When I add the second line I get this trace-back...

----------------------
Dr-Stupid: pauls$ ./manage.py sql myapp
Traceback (most recent call last):
  File "./manage.py", line 11, in ?
    execute_manager(settings)
  File ".../django/core/management.py", line 1297, in execute_manager
    execute_from_command_line(action_mapping, argv)
  File ".../django/core/management.py", line 1255, in
execute_from_command_line
    mod_list = [models.get_app(app_label) for app_label in args[1:]]
  File ".../django/db/models/loading.py", line 40, in get_app
    mod = load_app(app_name)
  File ".../django/db/models/loading.py", line 51, in load_app
    mod = __import__(app_name, '', '', ['models'])
  File "/Users/pauls/mysite/myapp/models.py", line 119, in ?
    class UserProfile(models.Model):
  File ".../django/db/models/base.py", line 49, in __new__
    new_class.add_to_class(obj_name, obj)
  File ".../django/db/models/base.py", line 131, in add_to_class
    value.contribute_to_class(cls, name)
  File ".../django/db/models/fields/related.py", line 662, in
contribute_to_class
    super(ManyToManyField, self).contribute_to_class(cls, name)
  File ".../django/db/models/fields/related.py", line 69, in
contribute_to_class
    self.do_related_class(other, cls)
  File ".../django/db/models/fields/related.py", line 79, in
do_related_class
    self.contribute_to_related_class(other, related)
  File ".../django/db/models/fields/related.py", line 672, in
contribute_to_related_class
    if related.model != related.parent_model or not
self.rel.symmetrical:
  File ".../django/db/models/fields/__init__.py", line 97, in __cmp__
    return cmp(self.creation_counter, other.creation_counter)
AttributeError: type object 'UserProfile' has no attribute
'creation_counter'
----------------------

(Sorry if that wraps at the wrong place, Google Groups posting window
wraps things)

Any ideas why this is causing a problem? Has anybody else tried this
type of structure?

Thanks

Paul


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to