i wrote a couple of filters and do thismaybe not as efficient..but
works for me...
{% filter label_asterisk_red %}
{{ posting_form|mark_required }}
{% endfilter %}
import re
from django import template
from django.template.defaultfilters import stringfilter
register = template.Library
On Oct 22, 11:33 am, [EMAIL PROTECTED] wrote:
> So, in the template, I was hoping to be able do something like:
>
> {{field.label_tag}}: {{field}}
> {% if field.error%}
> {{ field.error }}
> {% else %}
>{% if field.required%} *{% endif %}
> {% endif %}
> {% if field.help_text %}} color=
I've done something similar for auto-generated forms (form_for_model()
and form_for_instance()), by derivating a class from BaseForm and
providing my own _html_output() method, which emits the label with
different attributes depending on its "requiredness" (using the
'attrs' parameter to BoundFiel
I see what you mean but I dont think it will work because I want the
field elements to look sort of like:
[Prompt:] [Textbox] [a red '*' initially or a error message after
validation] [help text if any]
So, in the template, I was hoping to be able do something like:
{{field.label_tag}}: {{field
But I need to mark form fields from the model-generated forms too! I can
put "*" before the label in my own form. but what to do with generated
forms? There is a working example in Django admin part. I'll look to the
code
Ken пишет:
> By default all form fields are required. So, it seems to me th
By default all form fields are required. So, it seems to me that when
you define your forms class, you simply define your fields with a
'label' argument with the '*' tacked on. If you specify that the
field is not required, define it with a label that doesn't have the
'*' tacked on.
Does this w
I'm also looking for this very same solution...
Any advice is greatly appreciated!
Thanks,
Carlos :)
On Oct 7, 11:38 am, Oleg Korsak <[EMAIL PROTECTED]>
wrote:
> Hello! Is there any built-in method to make my form show required field
> label with bold (or some king of mark like "*") and other f
Hello! Is there any built-in method to make my form show required field
label with bold (or some king of mark like "*") and other fields as
normal text
signature.asc
Description: OpenPGP digital signature
8 matches
Mail list logo