Re: In forms, how add dynamic initial values out of reach for clients?
I've already read that and can't get the first one working: instance = Instance(required_field='value') form = InstanceForm(request.POST, instance=instance) new_instance = form.save() In my case, shouldn't it look like this: user = request.user discussion = Discussion.objects.get(pk=discussion_pk) form = CommentForm(request.POST, user=user, discussion=discussion) form = form.save() Or am I wrong? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: In forms, how add dynamic initial values out of reach for clients?
On Mon, Nov 17, 2008 at 1:24 AM, dexter <[EMAIL PROTECTED]> wrote: > > I want logged in users to be able to add comments but only want some > of the formfields displayed. Fields 'user', 'date' and 'discussion' > should be out of reach for my sitevisitors/clients. > ... > How should i solve this? I've tried numerous ways but none of them > really worked. http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a-subset-of-fields-on-the-form --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---