views:

32

answers:

1

Hi, This is my first post here, and I'd like to describe what I want to do as specific as possible.

I'd like to make a model that is 'selectable.'

for example,

class SimpleModel(models.Model):
property = models.CharField(max_length=255)
value = GeneralField()

GeneralField can be "CharField", "URLField", "TextField" so that user can select appropriate input type for specific property.

I'm kinda thinking of this similar to Wordpress's custom_field.

My initial thought is making TextField and tweak input interface depends on user's selection, but it's a bit tricky and if it involves file uploading functionality, it's gonna be complicated.

of course, I googled a lot. If you have any thoughts on this, please give me a tip :)

thanx in advance

A: 

How about creating a separate model for each type of field you want to support, and then another model consisting of a list of (table_name, entry_id) pairs, which could be customized to use any combination of fields?

Ryan Ginstrom