You have a lot of big questions and you'll need to do some more
learning of and practice Django to answer them all.  But, I will try
to answer some and point you in the right direction.

First, you linked a snippet of what seems to be your "models.py" file,
but much of what you wish to do will probably have to be accomplished
at the view layer in the "view.py" file.  At the view layer, you
handle requests and the user model for the current/requesting user is
accessible there.  (See here, for detailed information:
https://docs.djangoproject.com/en/1.2/topics/auth/#users .)  Code that
might allow you to get the user's name and email information might
look like this:

    if request.user.is_authenticated() :
        contextdict['email'] = request.user.email
        contextdict['fn'] = request.user.first_name
        contextdict['ln'] = request.user.last_name
        if request.user.is_staff :
            contextdict['sho_alnk'] = True
    return render_to_response('template.html', contextdict )

Then you could access those var.s in the contextdict from your web
template and use them to pre-populate your form, or display them
statically perhaps.

The link above also has information about groups and permissions,
which should help with your second question.  Another technique that
might help in getting a list of usernames into a model (and hence a
drop-down selection on the admin page) would be to add a field like
this to the model:

    approver = models.ForeignKey(User , limit_choices_to =
{'is_staff':True} )

That's not exactly what you've described, but there ought to be a way
to modify it to get "limit_choices_to" to use the group you create
rather than the boolean field User.is_staff .

Good luck.

K.C.

On Feb 3, 4:40 am, Krondaj <c.d.smi...@gmail.com> wrote:
> Hi,
>
> I have written a model for a web form (of sorts) I'm making that
> people can fill in from the admin site.  I have set permissions from
> the admin end so they can only write or change new posts of the form
> (seehttp://dpaste.org/BZ5Nm/). it's still work in progress  but I
> have two problems.
>
> First instead of using a CharField to take their name, i'd like it to
> auto populate, there full name and email address as they will be
> logged in and authenticated at the admin login site.
>
> Secondly instead of having a set of name choices for the approver i'd
> like to make a group in the admin called approver, and have it let you
> select from a list (so if we have a new approver i can just add them
> to the group).  I know how to make the group, i just don't know how to
> get the model to display these in the admin site as a drop-down list.
>
> I'd also like the database to link the first form and the second
> form... and make it so only the person who has been requested to do
> the work can fill in the required fields.
>
> Can anyone give me some clues/ell me how to do this.... My coding
> skillz are somewhat lacking!!??!! so i'd really appreciate any help!

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