Attachment 'models.py'

Download

   1 # -*- coding: UTF-8 -*-
   2 
   3 from django.db import models
   4 
   5 class Trieda(models.Model):
   6     rocnik=models.IntegerField()
   7     pismeno=models.CharField(max_length=5)
   8 
   9     def __unicode__(self):
  10         return u"%d.%s" % (self.rocnik,self.pismeno)
  11 
  12 
  13 class Predmet(models.Model):
  14     nazov=models.CharField(max_length=50)
  15 
  16     def __unicode__(self):
  17         return self.nazov
  18 
  19 
  20 class Ucitel(models.Model):
  21     meno=models.CharField(max_length=50)
  22     priezvisko=models.CharField(max_length=50)
  23     predmety=models.ManyToManyField(Predmet)
  24 
  25     def __unicode__(self):
  26         return u"%s %s" % (self.meno,self.priezvisko)
  27 
  28 
  29 class PredmetTrieda(models.Model):
  30     predmet=models.ForeignKey(Predmet)
  31     trieda=models.ForeignKey(Trieda)
  32     ucitel=models.ForeignKey(Ucitel)
  33 
  34     def __unicode__(self):
  35         return u"%s pre %s" % (self.predmet,self.trieda)
  36 
  37 
  38 class Ziak(models.Model):
  39     meno=models.CharField(max_length=50)
  40     priezvisko=models.CharField(max_length=50)
  41     trieda=models.ForeignKey(Trieda)
  42 
  43 
  44     def __unicode__(self):
  45         return u"%s %s" % (self.meno,self.priezvisko)
  46 
  47 ZNAMKA_CHOICES=(
  48     (1,"1"),(2,"2"),(3,"3"),(4,"4"),(5,"5"))
  49 
  50 class Znamka(models.Model):
  51     hodnotenie=models.IntegerField(choices=ZNAMKA_CHOICES)
  52     predmet=models.ForeignKey(Predmet)
  53     ziak=models.ForeignKey(Ziak)
  54 
  55 
  56     def __unicode__(self):
  57         return u"%d z %s pre %s" % (self.hodnotenie,self.predmet,self.ziak)

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.