... Hello!

I have a model (profile) which's only required field is its foreignkey
- django.contrib.auth.User.

Following the example of forementioned model and its manager i created
manager for the profile:

class ProfileManager(models.Manager):
        def create_profile(self, username):
                "Creates and saves a User with the given username, e-mail and
password."
                now = datetime.datetime.now()
                profile = self.model(None, username)
                profile.save()
                return profile

and Profile model is like this :
class Profile(models.Model):
        user = models.ForeignKey(User, unique=True)
        ......
        several other stuff all have null=True
        .......
        objects = ProfileManager()

Now when i do this in a view:
                        profile = Profile.objects.create_profile(request.user)

I get an error:

Exception Type:         TypeError
Exception Value:        int() argument must be a string or a number, not
'User'

So why is this not working?

Alan
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to