Re: Iterate over model database fields

2009-01-09 Thread bruno desthuilliers
On 8 jan, 23:56, Matias Surdi wrote: > Great!! > > I think that the _meta attribute will be enough. I think that if I > define a method on the base model of all my models something like > get_fields() it could then return a list of the fields by accessing > self._meta.fields, and this get_field

Re: Iterate over model database fields

2009-01-08 Thread Matias Surdi
Great!! I think that the _meta attribute will be enough. I think that if I define a method on the base model of all my models something like get_fields() it could then return a list of the fields by accessing self._meta.fields, and this get_fields should be accessible from templates,shouldn't

Re: Iterate over model database fields

2009-01-08 Thread bruno desthuilliers
On 8 jan, 16:22, Matias Surdi wrote: > Is there any way to iterate over all the fields in a model instance on a > template? Not directly. The fields names are accessible thru the model_instance._meta attribute, and you cannot access '_protected' attributes in a template. > I'd like to have a "d

Iterate over model database fields

2009-01-08 Thread Matias Surdi
Is there any way to iterate over all the fields in a model instance on a template? I'd like to have a "default" template which iterates over whatever model yo give it and prints all its field on a table. Any help will be appreciated. --~--~-~--~~~---~--~~ You