Hi thanks for quick response. I was thinking more about real custom attributes. Be able to define a string, or choice filed from admin. And after all create query and/or render form on it. Application that we are working at requires different attributes on objects from client to client. We were looking for something like alex's http://github.com/alex/django-taggit, but perfect situation will be a tag with a type(or choice)
thanks On Mon, Aug 30, 2010 at 6:20 PM, Beres Botond <boton...@gmail.com> wrote: > Hi Sebastian, > > I suppose you are trying to do something like this? > > class CustomAttributes(models.Model): > name = models.CharField(max_length=30) > value = models.CharField(max_length=50) > > class ObjectWithCustom(models.Model): > name = models.CharField(max_length=30) > attributes = models.ManyToManyField(CustomAttributes) > > new_attr = o.attributes.create(name='custom_attr', value='value') > > ObjectWithCustom.objects.filter(attributes__value='value') > > For more info about many-to-many check out docs: > http://www.djangoproject.com/documentation/models/many_to_many/ > Maybe describe in some detail what you are trying to accomplish (in > terms of resulting functionality), as this might not necessarily be > the best way to do it. > > Cheers, > > Béres Botond > > On Aug 30, 5:54 pm, Sebastian Pawlus <sebastian.paw...@gmail.com> > wrote: >> Hi >> >> Maybe im looking in wrong places or maybe there is no application to >> cover functionality of carrying custom/admin defined attributes, or >> maybe it isn't even possible. >> >> Use Case could looks like >> Defining models >> >> from customr_attr import models >> >> class ObjectWithCustom(models.Model): >> name = models.CharField(max_length=30) >> >> o = ObjectWithCustom.objects.create(name='test') >> o.custom_attr.create(name='custom_attr', value='value') >> >> >> o.custom_attr >> >> value >> >> >> ObjectWithCustom.objects.filter(custom_attr='value') >> >> [o] >> >> any ideas? > > -- > 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. > > -- 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.