Athat makes sense.
I was able to change the size of the text box in the widget file this way...
forms.TextInput(attrs={'size':'5'}),
Thanks again for all your help!! I learned a lot!
Mark
On Fri, Apr 11, 2014 at 9:03 AM, Lucas Klassmann
wrote:
> Hi Mark,
>
> You must understand that
Hi Mark,
You must understand that each Widget in :
widgets = (
forms.TextInput(attrs=attrs),
forms.TextInput(attrs=attrs),
forms.TextInput(attrs=attrs),
)
Has a *render()* method that return html of widget. You must only
concatenate each html of wi
Man, are you good;)
It now works as expected!
One last questionthe form shows three text boxes next to each other.
How can I change the html to look like this:
[ ] [ ] / []
{text_box} space {text_box} / {text_box}
It has something to do with format_output, but I don't unde
Hi Mark,
Because *TextInput *is a classe inside *forms *module and python is
*case-sensitive*, try this:
* forms.TextInput(attrs=attrs)*
Cheers.
On Fri, Apr 11, 2014 at 11:59 AM, Mark Phillips
wrote:
> Lucas,
>
> Thanks for your comment.
>
> I tried your suggestion, and got this error
>
> 'mo
Lucas,
Thanks for your comment.
I tried your suggestion, and got this error
'module' object has no attribute 'textInput'
referring to the forms.textInput(attrs=attrs) in the widget class.
I am only trying to replace three out of 16 fields in my Inventory model
with the custom widgets. I think
Hi!
I will test you code, but for now, try rewrite the form class, this way:
class MeasurementForm(forms.ModelForm):
width = forms.DecimalField(widget=MeasurementWidget())
height = forms.DecimalField(widget=MeasurementWidget())
length = forms.DecimalField(widget=MeasurementWidget())
I looked at the MultiWidget and tried to implement following a couple of
examples, but I have run into a problem. I get this error when I try to
open the admin form - type object 'MeasurementWidget' has no attribute
'attrs'
widgets.py
class MeasurementWidget(forms.MultiWidget):
def __init__(se
Hi!
I never used this, but i found here and can be useful:
https://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms.MultiWidget
Cheers.
On Thu, Apr 10, 2014 at 10:56 PM, Mark Phillips
wrote:
> I hope I am using the right terminology
>
> I have a Decimal field in a model calle
I hope I am using the right terminology
I have a Decimal field in a model called 'width'. In the admin screen, I
would like to display this field as three text boxes like this:
width: [] []/[]
so I can enter 2 1/8 for the width, and then have the code convert that to
2.125 as a Decimal fiel
9 matches
Mail list logo