Dylan, this is outdated info. The new Django does have access to the
request via a method called save_model that can be overwritten on the
ModalAdmin class for your model. It's a nice newforms admin feature :)
Rami Kassab
M 503.888.8605
W 503.626.6231
F 503.626.6233
6025 SW Jean Rd.
Lake Oswego, OR 97035
Sent from my iPhone.
On Apr 8, 2009, at 11:23 AM, Dylan Reinhardt
<[email protected]> wrote:
This is a common question for Django. The challenge here is that
request.user is known to the view, but not to the model... so you
can't just
make request.user the default value on the model.
Take a look at this and browse down to "The Holy Grail":
http://www.b-list.org/weblog/2006/nov/02/django-tips-auto-populated-fields/
HTH,
Dylan
On Wed, Apr 8, 2009 at 11:08 AM, Patrick Curtain
<[email protected]> wrote:
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
_______________________________________________
Portland mailing list
[email protected]
http://mail.python.org/mailman/listinfo/portland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/portland/attachments/20090408/4abf61e3/attachment.htm
>
_______________________________________________
Portland mailing list
[email protected]
http://mail.python.org/mailman/listinfo/portland
_______________________________________________
Portland mailing list
[email protected]
http://mail.python.org/mailman/listinfo/portland