On 5/12/2013 7:29pm, Harjot Mann wrote:
> In django form I want to add a * symbol on those fields which are
> compulsory so that user can recognize from the name of the field that
> this field is required field.
>
I've never done this in Django but normally I would use a CSS class. Try
looking up model field properties and if blank == False then make the
field widget nominate the "compulsory" CSS class.
I know this is nothing to do with your question but I use the following
utility function to return a verbose name. Maybe you can explore for the
value of a field's "blank" property instead of "verbose_name" ...
def verbose_name(obj, field):
return
obj.__class__()._meta.get_field_by_name('{0}'.format(field))[0].verbose_name
Good luck
Mike