Re: form new versus edit

2011-05-14 Thread br
My HTML guy and designer tend to get together to do some fancy stuff (read: pain in the butt) so sometimes I need to access the data that a model form field represents and can't just let django render it, which is obviously the preferred way and I go that way if possible. I am pretty knew to

Re: form new versus edit

2011-05-14 Thread Greg Donald
On Sat, May 14, 2011 at 5:20 PM, Shawn Milochik wrote: > One way: > > class CustomCharField(forms.CharField): > >     def __init__(self, *args, **kwargs): > >     super(CustomCharField, self).__init__(*args, **kwargs) > >     self.widget=forms.TextInput(attrs={

Re: form new versus edit

2011-05-14 Thread Shawn Milochik
On 05/14/2011 06:09 PM, Greg Donald wrote: On Sat, May 14, 2011 at 4:58 PM, Shawn Milochik wrote: > This isn't a case of "our way rules and if you disagree then you > suck." I just wanted to make sure you don't walk away with that > impression. How can I set this same

Re: form new versus edit

2011-05-14 Thread Greg Donald
On Sat, May 14, 2011 at 4:58 PM, Shawn Milochik wrote: > This isn't a case of "our way rules and if you disagree then you suck." I > just wanted to make sure you don't walk away with that impression. How can I set this same widget value name = CharField( widget=TextInput(

Re: form new versus edit

2011-05-14 Thread Shawn Milochik
On 05/14/2011 05:47 PM, Greg Donald wrote: On Sat, May 14, 2011 at 4:39 PM, Shawn Milochik wrote: I'm certain there are plenty of reasons that others could chime in with. In any case, you're free to do it however you like. But if you choose to use Django, be aware of the

Re: form new versus edit

2011-05-14 Thread Greg Donald
On Sat, May 14, 2011 at 4:39 PM, Shawn Milochik wrote: > I'm certain there are plenty of reasons that others could chime in with. In > any case, you're free to do it however you like. But if you choose to use > Django, be aware of the fact that a huge amount of thought has

Re: form new versus edit

2011-05-14 Thread Shawn Milochik
On 05/14/2011 05:33 PM, Greg Donald wrote: On Sat, May 14, 2011 at 4:22 PM, Daniel Roseman wrote: Which is what Shawn said. If you follow the pattern described in the excellent documentation, you'll see that there's no reason to try and reference the form's data, as the

Re: form new versus edit

2011-05-14 Thread Greg Donald
On Sat, May 14, 2011 at 4:22 PM, Daniel Roseman wrote: > Which is what Shawn said. If you follow the pattern described in the > excellent documentation, you'll see that there's no reason to try and > reference the form's data, as the form will re-render itself anyway if >

Re: form new versus edit

2011-05-14 Thread Daniel Roseman
On Saturday, 14 May 2011 22:14:38 UTC+1, Greg Donald wrote: > > On Sat, May 14, 2011 at 4:08 PM, Shawn Milochik > wrote: > > The problem is that you're doing this at all. You should instead be using > {{ > > form.name }} to put the field in the form. > > > Well that works

Re: form new versus edit

2011-05-14 Thread Shawn Milochik
On 05/14/2011 05:14 PM, Greg Donald wrote: On Sat, May 14, 2011 at 4:08 PM, Shawn Milochik wrote: On 05/14/2011 05:04 PM, Greg Donald wrote: I have a "new" contact form. If I post it, and it has error, I found (while debugging, not documented that I can find) that I can

Re: form new versus edit

2011-05-14 Thread Greg Donald
On Sat, May 14, 2011 at 4:08 PM, Shawn Milochik wrote: > On 05/14/2011 05:04 PM, Greg Donald wrote: >> >> I have a "new" contact form.  If I post it, and it has error, I found >> (while debugging, not documented that I can find) that I can redraw >> the submitted form data

Re: form new versus edit

2011-05-14 Thread Shawn Milochik
On 05/14/2011 05:04 PM, Greg Donald wrote: I have a "new" contact form. If I post it, and it has error, I found (while debugging, not documented that I can find) that I can redraw the submitted form data using form.name.data like this: The problem is that you're doing this at all. You

form new versus edit

2011-05-14 Thread Greg Donald
I have a "new" contact form. If I post it, and it has error, I found (while debugging, not documented that I can find) that I can redraw the submitted form data using form.name.data like this: But, if I use that same form model in my "edit" contact form, form.name.data is None. Why is that?