[portland] django helper
pcurtain at gmail.com
Wed Apr 8 20:41:01 CEST 2009
Wow! Everyone, thank you SOO much. That certainly gives me plenty to
go on. I'll hit everyone back with the solution that sticks in my
And good to see all the traffic and help available. I'd been lurking
and it seemed quiet. :)
On Wed, Apr 8, 2009 at 11:38 AM, Jeff Schwaber <freyley at gmail.com> wrote:
> On Wed, Apr 8, 2009 at 11:08 AM, Patrick Curtain <pcurtain at gmail.com> wrote:
>> 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.
>> 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?
> Most of what I've seen to try to do this isn't to set a default, it's to
> make it happen invisibly. For example, this:
> class ArticleAdmin(admin.ModelAdmin):
> exclude = ('member',)
> def save_model(self, request, obj, form, change):
> obj.member = request.user
> But looking at the doc, save_formset might do what you want:
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mail.python.org/pipermail/portland/attachments/20090408/c41c41da/attachment.htm>
> Portland mailing list
> Portland at python.org
Patrick Curtain, Husband & Father ( i also write software )
More information about the Portland