Sunday, November 25, 2012

Re: Comment user field

On Friday, November 23, 2012, Lachlan Musicman wrote:
It should be obvious, but I can't quite grok how to set the comment
user to request.user in the comments/form.html

I have a copy of comments/form.html in my templates folder in which
I've removed the email and the url fields, but now I want to either
set the default and auto fill to the user name or just to hide the
field but to put the user name in the POST data.

Don't mind me. 

For future reference:

Copied blatantly from base.html, added this field to the form.html
<input type="hidden" name="user_name" value="{% firstof user.first_name user.username %}" /> 

and removed the URL, email and name fields from the if field.errors part of the loop.

cheers
L.


--
...we look at the present day through a rear-view mirror. This is something Marshall McLuhan said back in the Sixties, when the world was in the grip of authentic-seeming future narratives. He said, "We look at the present through a rear-view mirror. We march backwards into the future."

http://www.warrenellis.com/?p=14314

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment