I have a set of people, I would like to associate to each person a card with personal informations and a list of things to do, this list doesn't have a fix size (it could have one or more fields), the admin is responsible to fill this list.
How can I give to the admin permissions to add extra fields in these cards through the admin page (not coding)? is it possible or do I must use a fixed-size list?
class Admin(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
birth_date = models.DateField(blank=True, null=True)
address = models.CharField(max_length=100, blank=True, null=True)
city = models.CharField(max_length=50, blank=True, null=True)
phone_number = models.CharField(max_length=20, blank=True, null=True)
email = models.EmailField(blank=True, null=True)
def __unicode__(self):
return u'%s %s' % (self.first_name, self.last_name)
class Person(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
birth_date = models.DateField(blank=True, null=True)
address = models.CharField(max_length=100, blank=True, null=True)
city = models.CharField(max_length=50, blank=True, null=True)
phone_number = models.CharField(max_length=20, blank=True, null=True)
email = models.EmailField(blank=True, null=True)
admin = models.ForeignKey(Admin, blank=True, null=True)
def __unicode__(self):
return u'%s %s' % (self.first_name, self.last_name)
class Card(models.Model):
id_number = models.IntegerField(default=0)
person = models.OneToOneField(Person, primary_key=True)
def __unicode__(self):
return unicode(self.id_number)
class Things_to_do(models.Model):
name = models.CharField(max_length=50)
repetitions = models.IntegerField(default=0, blank=True, null=True)
series = models.IntegerField(default=0, blank=True, null=True)
executions = models.IntegerField(default=0, blank=True, null=True)
rest_time = models.IntegerField(default=0, blank=True, null=True)
card = models.ForeignKey(Card, blank=True, null=True)
def __unicode__(self):
return unicode(self.name)