Tuesday, October 30, 2012

Re: Easy way to make all form fields read only?

Hiya Matt,

As you already noticed yourself there are lots of different possible approaches to what you're talking about.

But it depends on where/how the form is getting to the page.

How are you rendering the form? Are you using `forms.Form`?

Do you mean "user's credentials" from `django.contrib.auth`?

Regards,
Elena


On Tuesday, October 30, 2012 11:04:55 AM UTC+11, Matt Woodward wrote:
Semi-new to Django and working on my first "real" app, and I have a need based on the user's credentials to display forms as either editable or read-only. (Note this doesn't have anything to do with the Django admin in case that has any bearing on the discussion.)

Is there some fancy whiz-bang filter or middleware-type doo-dad (you can tell I'm still learning all the terminology) that would easily make all form fields read only?

I thought about using javascript (this is an internal app so we can mandate javascript be enabled) but before I went that route figured I'd ask if anyone has had to do this and how they approached it.

Personally I think it's weird to show someone a form they can't edit as opposed to just dumping them to a static display page, but wasn't my call.

Thanks!

--
Matthew Woodward
ma...@mattwoodward.com
http://blog.mattwoodward.com
identi.ca / Twitter: @mpwoodward

Please do not send me proprietary file formats such as Word, PowerPoint, etc. as attachments.
http://www.gnu.org/philosophy/no-word-attachments.html

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/wliSPC0e0Z0J.
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