On Jul 28, 4:27 pm, Derek <gamesb...@gmail.com> wrote:
> On Jul 28, 10:31 am,Shegoroa<trudicavan...@hotmail.com> wrote:
>
> > I am having difficulty figuring out how to make an admin when creating
> > a new user to have an extra field specifying users location.
>
> > I found lots of information on how to extend the user profile and i
> > did so
> > (source of 
> > information)http://stackoverflow.com/questions/44109/extending-the-user-model-wit...
>
> > But now I want the admin every time when he is creating a new user for
> > there to be a new field under Personal Information of a user to have
> > an extra field for Location of user.
>
> That is an old post (2008) - you're better off starting with the
> current 
> documentation:https://docs.djangoproject.com/en/dev/topics/auth/#storing-additional...
>
> Try and follow this and ask back here if you get stuck; showing what
> code you have created and identifying where/how it does not work (also
> see:https://code.djangoproject.com/wiki/UsingTheMailingList)



sorry for the delay in replying
I have added an extra field for the User by doing the whole process
where making User Profile app and extending the User module.

It doesn't seem to error. What I cant figure out, or find anywhere is
how to show this new field in the page where an admin creates a new
user. So under personal information such as First name and last Name I
want there to be Location field that I added to User Profile.

my User Profile:

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

class UserProfile(models.Model):
    # This field is required.
    user = models.OneToOneField(User)

    # Other fields here
    location = models.CharField(max_length=20)

# definition of UserProfile from above
# ...

def create_user_profile(sender, instance, created, **kwargs):
    if created:
        UserProfile.objects.create(user=instance)

post_save.connect(create_user_profile, sender=User)
also I would like to know how to make the email mandatory, like
password and username. Just changing the user model in the Django
folder to:

 email = models.EmailField(_('e-mail address'), unique=True)
didn't work at all.

-- 
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