how to determine field type in a form field?

2010-02-26 Thread Tom von Schwerdtner
When looping through form fields in a template, is there any way to tell what type of field/widget I'm dealing with in the template? I have found input_type, but that is only used on subclasses of Input and not Widget (eg, not textarea or checkbox). TIA -Tom -- You received this message

Re: Best way to handle "this obj relates to one of these three types of objects" ?

2010-02-01 Thread Tom von Schwerdtner
Shawn Milochik wrote: > Poof, magic! > > http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1 > > Django has this baked-in. Aha, awesome, thank you. -Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Best way to handle "this obj relates to one of these three types of objects" ?

2010-02-01 Thread Tom von Schwerdtner
I have a Resource, which can either be an image, a link or a document. What is the cleanest way to handle this? My thoughts are either, have them be attributes on the Resource object: class Resource(models.Model): name = models.CharField(...) # One of these image =

OneToOneField, and inlines

2009-05-10 Thread Tom von Schwerdtner
Greetings folks, I've been wrestling with this and I really don't know what I'm not doing right, so here is where I am: In basic pseudocode, I have: models.py: --- class Address(models.Model): ... ( street, city, etc) class Contact(models.Model): ... address =