Saturday, June 20, 2015

Re: NameError: name 'reciever' is not defined

Need a extra pair of eyes. :-)

Thanks for your answer

Op zaterdag 20 juni 2015 00:43:00 UTC+2 schreef James Schneider:

Check your spelling for receiver...

-James

On Jun 19, 2015 3:26 PM, "Marco Neumann" <m.ne...@webformant.nl> wrote:
Hi There,

Im stuck on above error. Anyone a hint? Many thanks

My code in models.py:

from django.db.models.signals import post_save
from django.dispatch import receiver
from django.db import models
from django.contrib.auth.models import User

class UserProfile(models.Model):
    user = models.OneToOneField(User)
    bio = models.TextField(max_length=500, null=True, blank=True)
    
    def __unicode__(self):
        return self.user.username
    
@reciever(post_save, sender=User)
def create_profile(sender, instance, created, **kwargs):
    if created:
        profile, new = UserProfile.objects.get_or_created(user=instance)



--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9dd30923-5e94-49d1-a321-a199138777a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/259b90c0-4ec2-419d-8e9c-19f3d9a802e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment