Hi,

I am not sure if what your asking is possible as a field type in a
database is generally a single field. What you are trying to do is
have an object as a field type. Perhaps you can do a ForeignKey and
have a m2m relationship between the GenericModel? From what I remember
you can have custom field types but it can only be types from a
database. Don't quote me on that but I think so. Have a look at this
where they go further into custom model fields.

http://docs.djangoproject.com/en/dev/howto/custom-model-fields/#custom-database-types

Hope this helps,

Thusjanthan Kubendranathan.

On Jul 6, 11:43 am, test157 <test...@smail.ee> wrote:
> hello,
>
> I need one solution so hope you can help me, e.g. I have this model
>
> class GenericModel(models.Model):
>     val1 = models.CharField(max_length=50)
>     val2 = models.CharField(max_length=80)
>
> and I need to create many virtual models based on this one above, so
> it will looks this way:
>
> class Info(models.Model):
>     name = GenricModel.val1
>     address = GenericModel.val2
>
> class Details(models.Model):
>     size = GenricModel.val1
>     height = GenericModel.val2
>
> e.t.c.
>
> is it possible or no? so when I access Details or Info I have to work
> with GenericModel - so it's some kind of proxy, but with overrided
> field names.
>
> anyone knows how to do it in Django? or it's impossible?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to