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 ov

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 sho

Re: Accessing fields on uninstantiated model

2009-03-11 Thread Alex Jillard
is unsubscriptable Which I guess means that self.fields is None. Any idea why this might be happening? On Wed, Mar 11, 2009 at 11:35 AM, Alex Gaynor wrote: > > > On Wed, Mar 11, 2009 at 10:33 AM, Alex Jillard wrote: > >> I'm trying to populate an admin form with the field names

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_

Re: Compare Lists for Unique Items

2008-11-26 Thread Alex Jillard
e key on the project's name field, then > you're good to go--no duplicates will ever get inserted. No need to > do any filtering ahead of time--just put each save() in a try/except > block that catches the error you get and does nothing. > > -Jeff > > On Nov 25, 4:53 pm

Re: Compare Lists for Unique Items

2008-11-25 Thread Alex Jillard
Thanks for the replies Jeff and Rajesh. I'll look int both of those options and see what I can come up with. My model is set to have the name of the project to be unique, so it was throwing an error if a duplicate was added. Jeff, unfortunatly the initial list of CVS projects is just a string th

Compare Lists for Unique Items

2008-11-25 Thread Alex Jillard
I've been working with Python and Django for the past week or so and thus far it's been great. My question is more of a general Python question than it is a Django question, but hopefully I can get some help or a link to an appropriate doc/website. So far I've not been able to dig up much useful