[portland] django helper
rami at typethink.com
Wed Apr 8 20:26:08 CEST 2009
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 :)
6025 SW Jean Rd.
Lake Oswego, OR 97035
Sent from my iPhone.
On Apr 8, 2009, at 11:23 AM, Dylan Reinhardt
<python at dylanreinhardt.com> 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":
> On Wed, Apr 8, 2009 at 11:08 AM, Patrick Curtain
> <pcurtain at gmail.com> wrote:
>>> 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
>> 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
>> How do I tell the admin interface form (via the internal 'class
>> 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!
>> Portland mailing list
>> Portland at python.org
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mail.python.org/pipermail/portland/attachments/20090408/4abf61e3/attachment.htm
> Portland mailing list
> Portland at python.org
More information about the Portland