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
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/52A03EA0.20505%40dewhirst.com.au.
For more options, visit https://groups.google.com/groups/opt_out.