Re: Forms - readonly representation?

2009-12-03 Thread Russell Keith-Magee
On Fri, Dec 4, 2009 at 3:29 AM, Todd Blanchard  wrote:
> From the deafening silence, I'm going to take this as a "no".

Ok - your "defening silence" lasted all of 2 hours. Seriously - I've
only just woken up from 7 hours of sleep, in which time you have asked
a question, and decided that was no answer. Please have some
consideration for the fact that your immediate problem might not be
everyone elses immediate problem, and that this is an international
mailing list spanning almost every single populated time zone on the
planet.

> And nobody thought of it?

Yes - clearly that's the answer.

http://lmgtfy.com/?q=readonly+django+field

Getting to the core of the matter:

http://code.djangoproject.com/ticket/342

http://code.djangoproject.com/wiki/Version1.2Features

Yours,
Russ Magee %-)

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Forms - readonly representation?

2009-12-03 Thread Matt Schinckel
On Dec 4, 8:50 am, Todd Blanchard  wrote:
> I'd gotten nearly a dozen responses to a later question so I figured the 
> threshold of awareness had passed on this one.

Don't assume that everyone who reads is in a similar timezone as you.
My machine shows your first post in this thread as 0305, and your
second post at 0529. I would have answered now, had Nick not already
provided a superior response.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Forms - readonly representation?

2009-12-03 Thread Nick Arnett
On Thu, Dec 3, 2009 at 2:50 PM, Todd Blanchard  wrote:

> I'd gotten nearly a dozen responses to a later question so I figured the
> threshold of awareness had passed on this one.


Never assume correlation implies causation... ;-)

Nick

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Forms - readonly representation?

2009-12-03 Thread Todd Blanchard
I'd gotten nearly a dozen responses to a later question so I figured the 
threshold of awareness had passed on this one.

Anyhow, I'll check that one out.  Thanks.

On Dec 3, 2009, at 2:48 PM, Nick Arnett wrote:

> tempted not to respond due to the "deafening silence" comment... did you 
> imagine you're due an instant answer?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Forms - readonly representation?

2009-12-03 Thread Nick Arnett
On Thu, Dec 3, 2009 at 9:05 AM, Todd Blanchard  wrote:

> Forms seem nifty, but sometimes I want to display the data in the same
> format but readonly.  Is there a to do this?  I can't seem to find it.


I found this gizmo for doing that sort of thing:

class ShowOnly(forms.Widget):
"""
Show only the data do NOT have a input field
"""
input_type = 'hidden'

def render(self, name, value, attrs=None):
from django.utils.safestring import mark_safe
from django.utils.encoding import force_unicode
if value is None: value = ''
final_attrs = self.build_attrs(attrs, type=self.input_type,
name=name)
if value != '':
# Only add the 'value' attribute if a value is non-empty.
value = force_unicode(value)
final_attrs['value'] = force_unicode(value)
return mark_safe(u'%s' %
(forms.util.flatatt(final_attrs),value))

I found it here:

http://www.djangosnippets.org/snippets/1185/

Nick
(tempted not to respond due to the "deafening silence" comment... did you
imagine you're due an instant answer?)

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Forms - readonly representation?

2009-12-03 Thread Bill Freeman
1.  You can sub class the form widget of interest to override the
render method, and,
for example, do "attrs['disabled'] = 'disabled'" before calling the
superclass method.
This is nasty because some browsers are actually fussy about the fact that the
disabled attribute doesn't take a value, but most do the right thing.
You may want
to also set an additional selector on the 'class' attribute (you need
to check whether
there already is one and append or set as appropriate) so that you can
style this
differently.  Or you could just do the rendering here yourself, though
that's messy,
or massage the string returned by the superclass method.

2.  If you're going to whine about it taking longer than a couple of
hours to get an
answer you:
a. are in for a frustrating life, and
b. should probably think about PAYING someone for support.

On Thu, Dec 3, 2009 at 2:29 PM, Todd Blanchard  wrote:
> From the deafening silence, I'm going to take this as a "no".
>
> Seems like a pretty basic enhancement - sometimes you want to display data in 
> the same layout as a form, but not editable (checkboxes disabled, text fields 
> just styled text).
>
> And nobody thought of it?
>
> On Dec 3, 2009, at 9:05 AM, Todd Blanchard wrote:
>
>> Forms seem nifty, but sometimes I want to display the data in the same 
>> format but readonly.  Is there a to do this?  I can't seem to find it.
>>
>> -Todd Blanchard
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Forms - readonly representation?

2009-12-03 Thread Javier Guerra
On Thu, Dec 3, 2009 at 2:29 PM, Todd Blanchard  wrote:
> From the deafening silence, I'm going to take this as a "no".
>
> Seems like a pretty basic enhancement - sometimes you want to display data in 
> the same layout as a form, but not editable (checkboxes disabled, text fields 
> just styled text).
>
> And nobody thought of it?

i guess it's a combination of at least two factors:

a) templates are easy enough

b) even if it's nice to just use {{form}} for the first tests, in the
end most forms get extended field-by-field in a full template.

given these, a R/O form would in the end be a regular template

-- 
Javier

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Forms - readonly representation?

2009-12-03 Thread Todd Blanchard
>From the deafening silence, I'm going to take this as a "no". 

Seems like a pretty basic enhancement - sometimes you want to display data in 
the same layout as a form, but not editable (checkboxes disabled, text fields 
just styled text).

And nobody thought of it?

On Dec 3, 2009, at 9:05 AM, Todd Blanchard wrote:

> Forms seem nifty, but sometimes I want to display the data in the same format 
> but readonly.  Is there a to do this?  I can't seem to find it.
> 
> -Todd Blanchard
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 
> 

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Forms - readonly representation?

2009-12-03 Thread Todd Blanchard
Forms seem nifty, but sometimes I want to display the data in the same format 
but readonly.  Is there a to do this?  I can't seem to find it.

-Todd Blanchard

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.