mark form field as required in markup

2007-12-07 Thread Frank 7200
Hi group,
another question. Is there a way how to pass an information to markup that a
form field is required?

I have this form with one field, which is required (default value).

class CustomForm(forms.Form):
age = forms.ChoiceField(label='Age', choices=AGE_CHOICES)


{{ form.as_table}}


This is what appears in the markup

Age:
0-3


I would need something like  because I would like
to highlite the whole table row. Or at least 

How can I do that?

Thanks for any advice,
Frank

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



get choice value in Form

2007-12-07 Thread Frank 7200
Hi group,
I have a form (from newforms) with choices

# Assume these are key-value pairs
AGE_CHOICES=(
(1, '0-3'),
(2, '3-6'),
(3, '6-15'),
)

class CustomForm(forms.Form):
age = forms.ChoiceField(label='Age', choices=AGE_CHOICES)

How can I get the value (not the key) of the age attribute after validation?

if f.is_valid():
cd = f.cleaned_data

cd['age'] # returns the "key", not the value

Thanks,
Frank

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



Get PK value in Field class after saving

2007-11-05 Thread Frank 7200
Hi,
I have a Field class for attachments and I would like to rename the
attachment after upload. This class inherits from models.ImageField.

The problem is that in field method save_file() and _save() all values
pointing to ID are None.
new_object['id'] is None and instance._get_pk_val() is None

In which method is the ID available?

Thanks in advance,
Frank

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