Django admin multi layour

Christian Kortenhorst (Forum) forum at namit.org
Fri Jul 11 05:31:54 EDT 2008


Hey All

Just been messing around with django and found that can not seam to get
admin to work how, it does not support multilayer input I want it I know
there is some way of writing your own "view", but wondering would it be
possible to write a multilayer setup or what is the wok around or what
should i be looking for?

my setup is

<python>
class Faculty(models.Model):
    class Admin: pass
    name = models.CharField(maxlength=200)
    director = models.CharField(maxlength=200)
    web_url = models.CharField(maxlength=200)

    def __str__(self):
        return self.name

class School(models.Model):
    class Admin: pass

    faculty = models.ForeignKey(Faculty)
    name = models.CharField(maxlength=200)

    def __str__(self):
        return self.name

class Programme(models.Model):
    class Admin: pass

    duration_choices = (
        ('Years', 'years'),
        ('Days', 'days')
    )

    school = models.ForeignKey(School)
    name = models.CharField(maxlength=200)
    description = models.CharField(maxlength=1000)

    def __str__(self):
        return self.name

class Stream(models.Model):
    class Admin: pass
    programme_code = models.ForeignKey(Programme,
edit_inline=models.TABULAR, num_in_admin=3)
    stream_number = models.IntegerField(core=True)

.....

</python>

Want to be able to click in and keep adding programs to a school and when i
do that a new box is created and a steam is created.

e.g.

add a Faculty
-> input for school is shown
-> add a school
-> -> input for Programme is shown
-> -> add a programme
-> -> -> etc..

also the option to add new school and program so can have a one to many
relationship.

Thanks
Christian K

-- 
Christian Kortenhorst
mod: +353-(0)87-6183349
home: +353-(0)1-4966287
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080711/3ccdb571/attachment.html>


More information about the Python-list mailing list