Re: Accessing fields on uninstantiated model

2009-03-13 Thread joemanfoo
Hi there, I think what you've figured out is something along the same lines that I'd like to do - but I'm very new to both Python and Django, so please pardon my ignorance in that I really didn't understand the solution you two spoke about. Here's what I'd like to do... I've two models, one for

Re: Accessing fields on uninstantiated model

2009-03-11 Thread Alex Jillard
Ah, that makes sense, thanks. With that change, I can use _meta.fields from my other model and everything works great. Thanks for the help On Wed, Mar 11, 2009 at 12:53 PM, Alex Gaynor wrote: > > > On Wed, Mar 11, 2009 at 11:50 AM, Alex Jillard wrote: > >> If I override get_form in ShelfAdmin

Re: Accessing fields on uninstantiated model

2009-03-11 Thread Alex Gaynor
On Wed, Mar 11, 2009 at 11:50 AM, Alex Jillard wrote: > If I override get_form in ShelfAdmin, I still get the same errors. > self.fields is still None...any idea how to get access to the fields? > > On Wed, Mar 11, 2009 at 12:26 PM, Alex Gaynor wrote: > >> >> >> On Wed, Mar 11, 2009 at 11:18 AM,

Re: Accessing fields on uninstantiated model

2009-03-11 Thread Alex Jillard
If I override get_form in ShelfAdmin, I still get the same errors. self.fields is still None...any idea how to get access to the fields? On Wed, Mar 11, 2009 at 12:26 PM, Alex Gaynor wrote: > > > On Wed, Mar 11, 2009 at 11:18 AM, Alex Jillard wrote: > >> Sorry Alex, I should have been more clea

Re: Accessing fields on uninstantiated model

2009-03-11 Thread Alex Gaynor
On Wed, Mar 11, 2009 at 11:18 AM, Alex Jillard wrote: > Sorry Alex, I should have been more clear, I need to access the fields of > another model. I went ahead and did what you said to try and get it > working, and I was able to get the fields from the form's model, but I get > an error when try

Re: Accessing fields on uninstantiated model

2009-03-11 Thread Alex Jillard
Sorry Alex, I should have been more clear, I need to access the fields of another model. I went ahead and did what you said to try and get it working, and I was able to get the fields from the form's model, but I get an error when trying to assign them to the choices property of my field. The fol

Re: Accessing fields on uninstantiated model

2009-03-11 Thread Alex Gaynor
On Wed, Mar 11, 2009 at 10:33 AM, Alex Jillard wrote: > I'm trying to populate an admin form with the field names of of a model > class, but I don't want to have to instantiate that model just to read it's > fields from _meta. > > I basically want to do something like this: > > self.fields['sort_

Accessing fields on uninstantiated model

2009-03-11 Thread Alex Jillard
I'm trying to populate an admin form with the field names of of a model class, but I don't want to have to instantiate that model just to read it's fields from _meta. I basically want to do something like this: self.fields['sort_by'].choices = [(field.verbose_name, field.name) for field in field_