Hello, Obj._meta.get_all_field_names() is what you are looking for.
Thank you. On Thu, Jul 16, 2015 at 11:23 PM, Sunil Gupta <su...@planmytour.in> wrote: > Hi All > > how can I iterate through the columns for an object in model > > example > for an given object of a model I want to print the verbose name and its > value when the help_text in the model is not NULL. > > class Client(models.Model): > cli_clientid = models.CharField(primary_key=True, verbose_name = > "Client Id", help_text= "This is help") > cli_client_type = models.CharField(max_length=4, verbose_name = > "Client Type", help_text= "") > > Assume Test_Client_Id is the value of cli_clientid os respective object > > for each column in Obj > if column.help_text != "" : > print "The column ", column.verbose_name, " has value ", > column.value > > expected output > > The column Client Id has value Test_Client_Id > > Thanks > Sunil > 9008524726 > > > _______________________________________________ > Chennaipy mailing list > Chennaipy@python.org > https://mail.python.org/mailman/listinfo/chennaipy > >
_______________________________________________ Chennaipy mailing list Chennaipy@python.org https://mail.python.org/mailman/listinfo/chennaipy