title: Django adding a custom field to registration
body: <p>I'm trying to add additional field for user's profile which can be edited only by administrator. </p>
  
  <p>When I try to save a new value of city in an administration module I'm getting an error:</p>
  
  <pre><code>global name 'created' is not defined
  </code></pre>
  
  <p>This error comes from: </p>
  
  <pre><code>signals.py in create_profile, line 7
  </code></pre>
  
  <p>I described what I have done till now :)
  I started a new app profil</p>
  
  <p>In models.py</p>
  
  <pre><code>from django.db import models
  from django.contrib.auth.models import User
  from django.utils.encoding import smart_str
  
  class UserProfile(models.Model):
      """Model przechowujący dodatkowe informacje o użytkowniku"""
      user = models.ForeignKey(User, unique=True)
      city = models.CharField(max_length=255, verbose_name=u'Miasto', blank=True, null=True)
  
      class Meta:
          verbose_name = 'Profil użytkownika'
          verbose_name_plural = 'Profile użytkowników'
  
      def __unicode__(self):
          return u'%s' self.user.username
  
      def __str__(self):
          return smart_str('%s' % self.user.username)
  
  import profil.signals
  </code></pre>
  
  <p>In file: signals.py</p>
  
  <pre><code>from django.contrib.auth.models import User
  from django.db.models.signals import post_save
  
  from profil.models import UserProfile
  
  def create_profile(sender, instance, **kwargs):
      if created == True:
          UserProfile.objects.get_or_create(user=instance)
  
  post_save.connect(create_profile, sender=User)
  </code></pre>
  
  <p>forms.py</p>
  
  <pre><code>from django import forms
  from profil.models import UserProfile
  
  class UserProfileForm(forms.ModelForm):
      '''Formularz modelu UserProfile'''
      class Meta:
          model = UserProfile
  </code></pre>
  
  <p>admin.py</p>
  
  <pre><code>from django.contrib import admin
  from django.contrib.auth.admin import UserAdmin
  from django.contrib.auth.models import User
  
  from profil.forms import UserProfileForm
  from profil.models import UserProfile
  
  class UserProfileInline(admin.StackedInline):
      model = UserProfile
      fk_name = 'user'
      max_num = 1
      form = UserProfileForm
  
  class UserProfileAdmin(UserAdmin):
      inlines = [UserProfileInline, ]
  
  admin.site.unregister(User)
  admin.site.register(User, UserProfileAdmin)
  </code></pre>