source: app/models.py

Last change on this file was 3d7fc00, checked in by Aleksandar <zaredite@…>, 14 months ago

Initial Commit

  • Property mode set to 100644
File size: 4.4 KB
Line 
1from django.db import models
2from django.contrib.auth.models import User
3
4
5class Artikal(models.Model):
6 artikal_id = models.AutoField(primary_key=True)
7 sifra = models.CharField(max_length=10)
8 artikal_ime = models.CharField(max_length=100)
9 cena = models.DecimalField(max_digits=10, decimal_places=2)
10 cenasoddv = models.DecimalField(max_digits=10, decimal_places=2)
11 ddvid = models.ForeignKey('Ddv', models.DO_NOTHING, db_column='ddvid', blank=True, null=True)
12
13 class Meta:
14 managed = False
15 db_table = 'artikal'
16
17 def __str__(self):
18 return self.artikal_ime
19
20
21class Bank(models.Model):
22 bankid = models.AutoField(primary_key=True)
23 bankime = models.CharField(unique=True, max_length=100)
24
25 class Meta:
26 managed = False
27 db_table = 'bank'
28
29 def __str__(self):
30 return self.bankime
31
32
33class Ddv(models.Model):
34 ddvid = models.AutoField(primary_key=True)
35 ddvval = models.SmallIntegerField(unique=True)
36
37 class Meta:
38 managed = False
39 db_table = 'ddv'
40
41 def __str__(self):
42 return str(self.ddvval)
43
44
45class Grad(models.Model):
46 gradid = models.AutoField(primary_key=True)
47 gradime = models.CharField(unique=True, max_length=50)
48 postbroj = models.SmallIntegerField(unique=True, blank=True, null=True)
49
50 class Meta:
51 managed = False
52 db_table = 'grad'
53
54 def __str__(self):
55 return self.gradime
56
57
58class Klient(models.Model):
59 klientid = models.AutoField(primary_key=True)
60 klientime = models.CharField(max_length=100)
61 adresa = models.CharField(max_length=100, blank=True, null=True)
62 gradid = models.ForeignKey(Grad, models.DO_NOTHING, db_column='gradid', blank=True, null=True)
63 phone = models.CharField(max_length=20, blank=True, null=True)
64 email = models.CharField(max_length=100, blank=True, null=True)
65 edb = models.CharField(unique=True, max_length=13)
66
67 class Meta:
68 managed = False
69 db_table = 'klient'
70
71 def __str__(self):
72 return self.klientime
73
74
75class Lagerlist(models.Model):
76 lagerlist_id = models.AutoField(primary_key=True)
77 stavkaid = models.ForeignKey('Stavka', models.DO_NOTHING, db_column='stavkaid', blank=True, null=True)
78 artikal = models.ForeignKey(Artikal, models.DO_NOTHING, blank=True, null=True)
79 kolicina = models.SmallIntegerField()
80 avg_cena = models.DecimalField(max_digits=10, decimal_places=2)
81
82 class Meta:
83 managed = False
84 db_table = 'lagerlist'
85
86
87class Stavka(models.Model):
88 stavkaid = models.AutoField(primary_key=True)
89 tipid = models.ForeignKey('Tipdok', models.DO_NOTHING, db_column='tipid', blank=True, null=True)
90 created_by = models.ForeignKey('Vraboteni', models.DO_NOTHING, db_column='created_by', blank=True, null=True)
91 datum = models.DateField()
92 broj = models.IntegerField()
93 klientid = models.ForeignKey(Klient, models.DO_NOTHING, db_column='klientid', blank=True, null=True)
94 cena_osnova = models.DecimalField(max_digits=10, decimal_places=2)
95 cena_ddv = models.DecimalField(max_digits=10, decimal_places=2)
96 cena_vkupno = models.DecimalField(max_digits=10, decimal_places=2)
97
98 class Meta:
99 managed = False
100 db_table = 'stavka'
101 ordering = ['-datum']
102
103
104class Tipdok(models.Model):
105 tipid = models.SmallIntegerField(primary_key=True)
106 tipime = models.CharField(unique=True, max_length=50)
107
108 class Meta:
109 managed = False
110 db_table = 'tipdok'
111
112 def __str__(self):
113 return self.tipime
114
115
116class Vraboteni(models.Model):
117 userid = models.OneToOneField(User, on_delete=models.CASCADE)
118 username = models.CharField(unique=True, max_length=100)
119 password = models.CharField(max_length=100)
120 email = models.CharField(max_length=100)
121 displayname = models.CharField(max_length=100, blank=True, null=True)
122 isadmin = models.BooleanField(blank=True, null=True)
123
124 class Meta:
125 managed = False
126 db_table = 'vraboteni'
127
128
129class Zirosmetki(models.Model):
130 zirosmetkiid = models.AutoField(primary_key=True)
131 klientid = models.ForeignKey(Klient, models.DO_NOTHING, db_column='klientid', blank=True, null=True)
132 bankid = models.ForeignKey(Bank, models.DO_NOTHING, db_column='bankid', blank=True, null=True)
133 broj = models.CharField(unique=True, max_length=15)
134
135 class Meta:
136 managed = False
137 db_table = 'zirosmetki'
138
139 def __str__(self):
140 return self.broj
Note: See TracBrowser for help on using the repository browser.