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

2012-11-01 Thread Matt Woodward
On Thursday, November 1, 2012 4:33:47 AM UTC-7, Amyth wrote: > I would suggest you adding Boolean field to your UserProfile model like > is_authorized = models.BooleanField(default=False) Cool -- thanks for the suggestion. As I've said I'm new to the Django world but this community rocks! :-)

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

2012-11-01 Thread Matt Woodward
On Wednesday, October 31, 2012 8:40:10 PM UTC-7, elena wrote: > I was also going to suggest using crispy forms -- having used it on a > recent project I'd strongly recommend it (it's great when it's plugged in > to existing stylings such as: uni-form or bootstrap). > > I've used it with

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

2012-11-01 Thread Amyth Arora
I would suggest you adding Boolean field to your UserProfile model like is_authorized = models.BooleanField(default=False) and then in the templates do something like: {% if user.is_authorized %} {% else %} On Thu, Nov 1, 2012 at 9:09 AM, Elena Williams wrote: > I

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

2012-10-31 Thread Elena Williams
I was also going to suggest using crispy forms -- having used it on a recent project I'd strongly recommend it (it's great when it's plugged in to existing stylings such as: uni-form or bootstrap). I've used it with ModelForm using Layout() and Field() and it works a treat. --- Elena :) @elequ

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

2012-10-31 Thread Paul
I used to invest something similar; i wanted to to built a read view next to an update view that looks identical except for that read is obviously read-only. I used crispy-forms to do just that; recently an UneditableField (Layout) was added next to Field. You do however either need to

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

2012-10-30 Thread Matt Woodward
On Tuesday, October 30, 2012 5:20:44 AM UTC-7, ke1g wrote: > Another protective hack would be to omit the > CSRF token when the form is read only. > Thanks -- interesting idea! Ultimate goal is for the user to be able to tell they can't edit the form via the fields being read only (which

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

2012-10-30 Thread Matt Woodward
On Tuesday, October 30, 2012 7:09:05 AM UTC-7, JirkaV wrote: > On the UI side, you can set the "readonly" property on form fields. > This will prevent the field from being edited in a browser (I think so > - done that only once on a small internal project). > Thanks -- I probably should have

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

2012-10-30 Thread Matt Woodward
On Tuesday, October 30, 2012 1:36:19 AM UTC-7, elena wrote: > How are you rendering the form? Are you using `forms.Form`? > We're using a ModelForm specifically. > > Do you mean "user's credentials" from `django.contrib.auth`? > Actually this is a custom user object -- users authenticate

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

2012-10-30 Thread Jirka Vejrazka
On the UI side, you can set the "readonly" property on form fields. This will prevent the field from being edited in a browser (I think so - done that only once on a small internal project). However, we warned - if *some* of your users can edit and submit the form, you should also introduce

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

2012-10-30 Thread elena
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

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

2012-10-30 Thread Bill Freeman
On Mon, Oct 29, 2012 at 8:04 PM, Matthew 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

Easy way to make all form fields read only?

2012-10-29 Thread Matthew Woodward
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