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}}

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

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