v002 migrations

This commit is contained in:
2026-05-21 03:33:17 +00:00
parent 83fb8c69bb
commit c078a257e9
101 changed files with 281 additions and 4 deletions

4
.gitignore vendored
View File

@@ -1,4 +1,8 @@
# ---> Python
# Django
staticfiles/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

View File

@@ -140,6 +140,7 @@ USE_TZ = True
# https://docs.djangoproject.com/en/6.0/howto/static-files/
STATIC_URL = 'static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
# Automatski koristi filtriranje na svim API endpointima koji podržavaju filtriranje

View File

@@ -40,4 +40,5 @@ urlpatterns = [
# Dodajemo pristup media datotekama samo u development fazi
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

View File

@@ -0,0 +1,53 @@
# Generated by Django 6.0.5 on 2026-05-20 20:03
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('kupci', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Vozilo',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('naziv', models.CharField(max_length=50, verbose_name='Interni naziv')),
('registracija', models.CharField(db_index=True, max_length=15, unique=True)),
('pocetni_kilometri', models.PositiveIntegerField(default=0)),
('trenutni_kilometri', models.PositiveIntegerField(default=0)),
('status', models.CharField(choices=[('aktivan', 'Aktivan'), ('servis', 'Na Servisu'), ('neaktivan', 'Izvan Pogona')], default='aktivan', max_length=20)),
],
options={
'verbose_name': 'Vozilo',
'verbose_name_plural': 'Vozila',
'ordering': ['naziv'],
},
),
migrations.CreateModel(
name='Stroj',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('naziv', models.CharField(help_text='Npr. Liebherr LTM 1030', max_length=100)),
('serijski_broj', models.CharField(max_length=50, unique=True)),
('marka', models.CharField(blank=True, max_length=50)),
('model_stroja', models.CharField(blank=True, max_length=50)),
('godina_proizvodnje', models.PositiveIntegerField(blank=True, null=True)),
('tip', models.CharField(choices=[('dizalica_toranj', 'Toranjska dizalica'), ('dizalica_auto', 'Autodizalica'), ('vilicar', 'Viličar'), ('platforma', 'Radna platforma')], max_length=30)),
('radni_sati', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
('registracija', models.CharField(blank=True, help_text='Za autodizalice i vozila', max_length=20, null=True)),
('datum_zadnjeg_atesta', models.DateField(blank=True, null=True)),
('vlasnik', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='strojevi', to='kupci.kupac', verbose_name='Vlasnik/Kupac')),
],
options={
'verbose_name': 'Stroj',
'verbose_name_plural': 'Strojevi',
'ordering': ['marka', 'model_stroja'],
},
),
]

View File

View File

@@ -0,0 +1,42 @@
# Generated by Django 6.0.5 on 2026-05-20 20:04
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('fleet', '0001_initial'),
('kupci', '0001_initial'),
('operations', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Dogadaj',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('naslov', models.CharField(max_length=200)),
('opis', models.TextField(blank=True)),
('tip', models.CharField(choices=[('servis', 'Radni Nalog / Servis'), ('isporuka', 'Isporuka Stroja'), ('sastanak', 'Sastanak s kupcem'), ('biljeska', 'Interna bilješka')], default='biljeska', max_length=20)),
('pocetak', models.DateTimeField()),
('kraj', models.DateTimeField()),
('datum_kreiranja', models.DateTimeField(auto_now_add=True)),
('datum_azuriranja', models.DateTimeField(auto_now=True)),
('klijent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='kupci.kupac')),
('radni_nalog', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='kalendar_termin', to='operations.radninalog')),
('serviser_u_kalendaru', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dodatni_zadaci', to=settings.AUTH_USER_MODEL)),
('vozilo', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='fleet.vozilo')),
],
options={
'verbose_name': 'Kalendar',
'verbose_name_plural': 'Kalendar',
'ordering': ['pocetak'],
},
),
]

View File

@@ -0,0 +1,36 @@
# Generated by Django 6.0.5 on 2026-05-20 20:03
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Kupac',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('naziv', models.CharField(help_text='Ime i prezime ili puni naziv tvrtke', max_length=255)),
('oib', models.CharField(blank=True, max_length=11, null=True, unique=True, verbose_name='OIB')),
('email', models.EmailField(blank=True, max_length=254)),
('telefon', models.CharField(blank=True, max_length=50)),
('adresa', models.CharField(blank=True, max_length=255)),
('grad', models.CharField(blank=True, max_length=100)),
('postanski_broj', models.CharField(blank=True, max_length=10)),
('tip', models.CharField(choices=[('pravno', 'Pravna osoba (Tvrtka)'), ('fizicko', 'Fizička osoba')], default='pravno', max_length=10)),
('napomena', models.TextField(blank=True, help_text='Interni podaci o kupcu')),
('datum_kreiranja', models.DateTimeField(auto_now_add=True)),
('aktivno', models.BooleanField(default=True)),
],
options={
'verbose_name': 'Kupac',
'verbose_name_plural': 'Kupci',
'ordering': ['naziv'],
},
),
]

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

View File

@@ -0,0 +1,76 @@
# Generated by Django 6.0.5 on 2026-05-20 20:03
import django.db.models.deletion
import django.utils.timezone
import operations.models
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('fleet', '__first__'),
('kupci', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='PutniNalog',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('broj_naloga', models.CharField(max_length=50, unique=True)),
('datum_izdavanja', models.DateField(default=django.utils.timezone.now)),
('relacija', models.CharField(max_length=255)),
('mjesto_odredista', models.CharField(max_length=255)),
('pocetna_km', models.PositiveIntegerField(editable=False, help_text='Automatski preuzeto iz modela Vozilo')),
('zavrsna_km', models.PositiveIntegerField(blank=True, null=True)),
('vrijeme_polaska', models.DateTimeField(default=django.utils.timezone.now)),
('vrijeme_povratka', models.DateTimeField(blank=True, null=True)),
('status', models.CharField(choices=[('OTVOREN', 'Otvoren'), ('ZAVRSEN', 'Završen')], default='OTVOREN', max_length=15)),
('korisnik', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
('vozilo', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='putni_nalozi', to='fleet.vozilo', verbose_name='Službeno vozilo')),
],
options={
'verbose_name': 'Putni nalog',
'verbose_name_plural': 'Putni nalozi',
},
),
migrations.CreateModel(
name='RadniNalog',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('broj_naloga', models.CharField(blank=True, max_length=20, unique=True)),
('opis_kvara', models.TextField()),
('status', models.CharField(choices=[('PLANIRANO', 'Planirano'), ('U_RADU', 'U radu'), ('ZAVRSENO', 'Završeno')], default='PLANIRANO', max_length=20)),
('datum_kreiranja', models.DateTimeField(auto_now_add=True, verbose_name='Datum kreiranja')),
('datum_azuriranja', models.DateTimeField(auto_now=True, verbose_name='Zadnja izmjena')),
('slika_kvara', models.ImageField(blank=True, null=True, upload_to=operations.models.putanja_slike_naloga)),
('potpis_klijenta', models.ImageField(blank=True, null=True, upload_to='potpisi/%Y/%m/')),
('izvrsitelj', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dodijeljeni_nalozi', to=settings.AUTH_USER_MODEL)),
('klijent', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='radni_nalozi', to='kupci.kupac')),
('putni_nalog', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='radni_nalozi', to='operations.putninalog')),
('stroj', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='radni_nalozi', to='fleet.stroj', verbose_name='Stroj na popravku')),
],
options={
'verbose_name': 'Radni nalog',
'verbose_name_plural': 'Radni nalozi',
},
),
migrations.CreateModel(
name='RadniNalogSlika',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('slika', models.ImageField(upload_to=operations.models.putanja_galerije_naloga, verbose_name='Slika')),
('opis', models.CharField(blank=True, max_length=100, verbose_name='Kratki opis slike')),
('radni_nalog', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='slike', to='operations.radninalog')),
],
options={
'verbose_name': 'Dodatna slika naloga',
'verbose_name_plural': 'Dodatne slike naloga',
},
),
]

Binary file not shown.

View File

@@ -0,0 +1,47 @@
# Generated by Django 6.0.5 on 2026-05-20 20:03
import django.contrib.auth.models
import django.contrib.auth.validators
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]
operations = [
migrations.CreateModel(
name='CustomUser',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('email', models.EmailField(max_length=254, unique=True)),
('telefon', models.CharField(blank=True, max_length=20)),
('oib', models.CharField(blank=True, max_length=11, null=True)),
('is_serviser', models.BooleanField(default=False)),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')),
],
options={
'verbose_name': 'user',
'verbose_name_plural': 'users',
'abstract': False,
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
]

View File

Some files were not shown because too many files have changed in this diff Show More