Ticket #15766: models.py

File models.py, 1.9 KB (added by Carsten Fuchs, 14 years ago)

The models.py file referred to in comment #2 to reproduce the issue.

Line 
1# -*- coding: utf-8 -*-
2from django.db import models
3from django.db.models import Sum
4from django.core.exceptions import ObjectDoesNotExist
5from datetime import *
6from decimal import *
7
8
9class Kostenstelle(models.Model):
10 id = models.AutoField(primary_key=True)
11 name = models.CharField(max_length=60, blank=True)
12
13 class Meta:
14 db_table = u'kostenstelle'
15
16
17class Code(models.Model):
18 id = models.BigIntegerField(primary_key=True)
19 text = models.CharField(max_length=60, blank=True)
20 grenzwert = models.DecimalField(null=True, max_digits=5, decimal_places=2, blank=True)
21
22 class Meta:
23 db_table = u'code'
24
25
26class Mitarbeiter(models.Model):
27 id = models.AutoField(primary_key=True)
28 key = models.CharField(max_length=10, unique=True)
29
30 geburtstag = models.DateField()
31 eintritt = models.DateField()
32 sperre = models.DateField(null=True, blank=True)
33
34 name = models.CharField(max_length=80)
35 vorname = models.CharField(max_length=80)
36 code = models.ForeignKey(Code, db_column='code')
37
38 class Meta:
39 db_table = u'mitarbeiter'
40 ordering = ['name', 'vorname']
41
42
43class Status(models.Model):
44 id = models.AutoField(primary_key=True)
45 status = models.CharField(max_length=45, blank=True)
46 statustext = models.CharField(max_length=8, blank=True)
47
48 class Meta:
49 db_table = u'status'
50 ordering = ['id']
51
52
53class Erfasst(models.Model):
54 id = models.AutoField(primary_key=True)
55 key = models.ForeignKey(Mitarbeiter, db_column='key', to_field='key')
56
57 datum = models.DateField()
58 code = models.ForeignKey(Code, db_column='code')
59 status = models.ForeignKey(Status, db_column='status')
60 realkst = models.ForeignKey(Kostenstelle, db_column='realkst')
61
62 class Meta:
63 db_table = u'erfasst'
Back to Top