Note that there are some explanatory texts on larger screens.

plurals
  1. POdjango models - can admin add variables to a table?
    primarykey
    data
    text
    <p>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.</p> <p>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?</p> <pre><code>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) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload