Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Dynamic Fields and Saving data per user [RSS Feed]

#1 Dec. 13, 2010 11:18:14

D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Dynamic Fields and Saving data per user


I am trying to make an app where each user will have like a mailing
list for which they should be-able to create custom fields for any
data they may want to hold and be able to save multiple rows of that
data.

I was thinking to use a model to hold the fields definitions and a key
value system to hold the data, something like this:

class Maillist(models.Model):
user = models.ForeignKey(User)
....

class Subscriber(models.Model):
email = models.EmailField()
list = models.ForeignKey(List)

class ListField(models.Model):
list = models.ForeignKey(Maillist)
field_type = models.IntegerField(choices=FIELD_TYPE_CHOICES)
label = models.CharField(_('Label'), max_length=100)

class SubscriberData(models.Model):
subscriber= models.ForeignKey(Subscriber, db_index=True)
key = models.ForeignKey(ListField, db_index=True)
value = models.CharField(max_length=240, db_index=True)

Would this even work properly? Is there some better way to do it, what
about dynamically creating a model and its fields for each MailList?

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » Dynamic Fields and Saving data per user [RSS Feed]

Board footer

Moderator control

Enjoy the 24th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support