Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7185815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:29:54+00:00 2026-05-28T18:29:54+00:00

Possible Duplicate: Django dynamic model fields Good Morning guys! Scenario is the following. For

  • 0

Possible Duplicate:
Django dynamic model fields

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_model ), which django already has an app for. See http://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!

Very similar: How to create user defined fields in Django — but only talks about the EAV, which I would like to avoid. I’m open for new ideas!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:29:56+00:00Added an answer on May 28, 2026 at 6:29 pm

    One approach is to use a NoSQL document-based solution such as MongoDB which allows you to store objects that have a fluid structure (no such restrictions as pre-defined columns).

    Pros:

    1. No restriction on custom field types, number of types of fields, etc.
    2. Retains ORM functionality (django-mongodb)
    3. Other various benefits of NoSQL – which you can read about online
    4. Avoids EAV

    Cons:

    1. Need to setup NoSQL server
    2. Additional knowledge required on NoSQL concepts (documents vs. tables)
    3. You may have to maintain two databases – if you decide not to migrate your entire solution to NoSQL (multi-db)

    EDIT:

    After reading the comments its worth pointing out that depending on which NoSQL solution you go with, you may not need reversion support. CouchDB, for example has built in support for document versioning.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Django Model Inheritance query a central table Following along the officail docs
Possible Duplicate: Override django-admin edit form field values for encrypted data The inline model
Possible Duplicate: C# driver development? I would like to know if I can do
Possible Duplicate: Are there any all in one packages like XAMPP for Django? Is
Possible Duplicate: Django - Iterate over model instance field names and values in template
Possible Duplicate: update django database to reflect changes in existing models I've used Django
Possible Duplicate: Verbose name for admin model Class in django I had a model
Possible Duplicate: Django QuerySet ordering by expression If I had a model with 3
Possible Duplicate: Properly handling spaces and quotes in bash completion I would like to
Possible Duplicate: Django switching, for a block of code, switch the language so translations

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.