[portland] django helper

Patrick Curtain pcurtain at gmail.com
Wed Apr 8 20:08:09 CEST 2009


Hey!

> There's a few of us here who work on Django.  If you have specific
> questions, you could probably get several responses.  Some might even be
> helpful.  :-)

I'll start here then, for now.  :)  Thanks!  Anyone else, feel free to
tell me it's too specific for the pdxpython list.

I've got a 'Recipe' model that needs to store the author.  From what I
could learn in other examples, this got added to my model:

    member = models.ForeignKey(User, related_name="added_recipes",
blank=True, null=True)

When I view the form in the admin interface, it works, but that field
shows up as a select box of all users in the system.

My goal is to let some bulk data entry happen in advance of the full
app being completed.  Hence the push to make it work in admin and get
going.

Question:

How do I tell the admin interface form (via the internal 'class Admin'
magic ideally) that it should get the user from the 'request.user'
currently using the app?

Responses of "dumb idea, do this instead" -just- as welcome.  :)

And thanks, everyone!
--p


More information about the Portland mailing list