That's a great reference, many thanks ivan!

On Jan 29, 4:58 pm, Ivan Kharlamov <the.paper....@gmail.com> wrote:
> On 01/29/2012 12:18 PM, Bernardo Pires wrote:
>
>
>
>
>
>
>
>
>
> > Good Morning guys!
> > Scenario is the following. For some models on Django, I would like to
> > allow the end user to define his own fields. It would be great if I
> > could keep all Django awesome features like the ORM, so I can still do
> > calls like field__gte to search on the model, still have field
> > validation according to field type, etc. I've thought about two ways
> > of doing this, and I'm more than open for new suggestions. Any
> > feedback would be VERY appreciated.
>
> > 1. The first approach, is the Entity-Attribute-Value (
> >http://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_m...
> > ), which django already has an app for. 
> > Seehttp://code.google.com/p/django-custom-field/
> > I think this would be an OK solution, but I lose the ability to do
> > "mymodel.objects.filter(custom_field_x=something)". Maybe there's a
> > way to regain the ORM, any ideas? But I've heard so many bad stories
> > about this method that I'm little scared to use it.
>
> > 2. The second approach would be to have a database table for each of
> > the users (probably no more than a 1000). I've read django has
> > something in the lines of inspectdb, which actually checks which
> > fields are there and produces the model for you. This could be useful
> > but I think maybe I should store the fields this particular user has
> > created and somehow dinamically tell django, hey, we also have this
> > fields in this model. Is this possible? I know it's generally bad to
> > have different tables for each user, but considering this scenario,
> > how would you guys rate this method, would it be ok to have one table
> > for each user?
>
> > The model that requires custom fields is for example Person. They
> > might want a custom field to store address, blood type, or any other
> > thing.
>
> > MANY THANKS in advance! Have a nice sunday!
> > Bernardo Pires
>
> Bernardo, Hello.
>
> For other options checkout this 
> guide:http://stackoverflow.com/a/7934577/497056
>
> Best regards,
> Ivan Kharlamov

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

Reply via email to