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
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
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
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
4 matches
Mail list logo