Saturday, June 20, 2015

Re: NameError: name 'reciever' is not defined

Thanks for your response.

I need a extra pair of eyes. :-)

Op zaterdag 20 juni 2015 00:27:07 UTC+2 schreef Marco Neumann:
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+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/7b3d8e1d-bd85-48db-9501-cb6e16b6d325%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment