Skip to content

Commit

Permalink
db import
Browse files Browse the repository at this point in the history
  • Loading branch information
lamanchy committed May 16, 2022
1 parent 5ba652c commit 8d7bea1
Show file tree
Hide file tree
Showing 69 changed files with 2,781 additions and 88 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ __pycache__
/postgresqldata_test
.env

/.idea
/.idea
/backend/old_database_dump
16 changes: 12 additions & 4 deletions backend/administration_units/admin.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
from django.contrib import admin

from administration_units.models import OrganizingUnit, BrontosaurusMovement
from administration_units.models import AdministrationUnit, BrontosaurusMovement
from bis.admin_helpers import EditableByAdminOnlyMixin


@admin.register(OrganizingUnit)
class OrganizingUnitAdmin(EditableByAdminOnlyMixin, admin.ModelAdmin):
@admin.register(AdministrationUnit)
class AdministrationUnitAdmin(EditableByAdminOnlyMixin, admin.ModelAdmin):
list_display = 'name',
search_fields = 'name',
filter_horizontal = 'board_members',

autocomplete_fields = 'chairman', 'manager', 'board_members'

exclude = '_import_id',


@admin.register(BrontosaurusMovement)
class BrontosaurusMovementAdmin(EditableByAdminOnlyMixin, admin.ModelAdmin):
filter_horizontal = 'bis_administrators', 'office_workers', 'audit_committee', 'executive_committee', 'education_members',
filter_horizontal = 'bis_administrators', 'office_workers', 'audit_committee', \
'executive_committee', 'education_members',

autocomplete_fields = 'director', 'bis_administrators', 'office_workers', 'audit_committee', \
'executive_committee', 'education_members'
41 changes: 41 additions & 0 deletions backend/administration_units/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Generated by Django 4.0.3 on 2022-03-23 15:35

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='AdministrationUnit',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=63)),
],
options={
'ordering': ('id',),
},
),
migrations.CreateModel(
name='AdministrationUnitMember',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('since', models.DateTimeField()),
('till', models.DateTimeField()),
],
options={
'ordering': ('id',),
},
),
migrations.CreateModel(
name='BrontosaurusMovement',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
),
]
84 changes: 84 additions & 0 deletions backend/administration_units/migrations/0002_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Generated by Django 4.0.3 on 2022-03-23 15:35

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
('categories', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('administration_units', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='brontosaurusmovement',
name='audit_committee',
field=models.ManyToManyField(related_name='+', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='brontosaurusmovement',
name='bis_administrators',
field=models.ManyToManyField(related_name='+', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='brontosaurusmovement',
name='director',
field=models.ForeignKey(help_text='Má veškerá oprávnění', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='brontosaurusmovement',
name='education_members',
field=models.ManyToManyField(related_name='+', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='brontosaurusmovement',
name='executive_committee',
field=models.ManyToManyField(related_name='+', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='brontosaurusmovement',
name='office_workers',
field=models.ManyToManyField(related_name='+', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='administrationunitmember',
name='administration_unit',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='administration_units.administrationunit'),
),
migrations.AddField(
model_name='administrationunitmember',
name='category',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='categories.administrationunitboardmembercategory'),
),
migrations.AddField(
model_name='administrationunitmember',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='administrationunit',
name='board_members',
field=models.ManyToManyField(related_name='administration_units', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='administrationunit',
name='category',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='administration_units', to='categories.administrationunitcategory'),
),
migrations.AddField(
model_name='administrationunit',
name='chairman',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='administrationunit',
name='manager',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Generated by Django 4.0.3 on 2022-05-09 16:01

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import phonenumber_field.modelfields


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('administration_units', '0002_initial'),
]

operations = [
migrations.AddField(
model_name='administrationunit',
name='abbreviation',
field=models.CharField(default='', max_length=63),
preserve_default=False,
),
migrations.AddField(
model_name='administrationunit',
name='email',
field=models.EmailField(max_length=254, null=True),
),
migrations.AddField(
model_name='administrationunit',
name='existed_since',
field=models.DateField(null=True),
),
migrations.AddField(
model_name='administrationunit',
name='existed_till',
field=models.DateField(blank=True, null=True),
),
migrations.AddField(
model_name='administrationunit',
name='is_for_kids',
field=models.BooleanField(default=False),
preserve_default=False,
),
migrations.AddField(
model_name='administrationunit',
name='phone',
field=phonenumber_field.modelfields.PhoneNumberField(max_length=128, null=True, region=None),
),
migrations.AddField(
model_name='administrationunit',
name='www',
field=models.URLField(null=True),
),
migrations.AlterField(
model_name='administrationunit',
name='chairman',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='administrationunit',
name='manager',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL),
),
migrations.CreateModel(
name='AdministrationUnitAddress',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('street', models.CharField(max_length=127)),
('city', models.CharField(max_length=63)),
('zip_code', models.CharField(max_length=5)),
('administration_unit', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='address', to='administration_units.administrationunit')),
],
options={
'ordering': ('id',),
},
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.0.3 on 2022-05-09 16:09

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('administration_units', '0003_administrationunit_abbreviation_and_more'),
]

operations = [
migrations.AlterField(
model_name='administrationunit',
name='name',
field=models.CharField(max_length=255),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.0.3 on 2022-05-09 16:55

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('administration_units', '0004_alter_administrationunit_name'),
]

operations = [
migrations.AddField(
model_name='administrationunit',
name='bank_account_number',
field=models.CharField(blank=True, max_length=63, null=True),
),
migrations.AddField(
model_name='administrationunit',
name='ic',
field=models.CharField(max_length=7, null=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.0.3 on 2022-05-09 17:06

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('administration_units', '0005_administrationunit_bank_account_number_and_more'),
]

operations = [
migrations.AlterField(
model_name='administrationunit',
name='ic',
field=models.CharField(max_length=15, null=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.0.3 on 2022-05-11 09:42

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('administration_units', '0006_alter_administrationunit_ic'),
]

operations = [
migrations.AddField(
model_name='administrationunit',
name='import_id',
field=models.CharField(default='', max_length=15),
preserve_default=False,
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 4.0.3 on 2022-05-12 07:21

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('administration_units', '0007_administrationunit_import_id'),
]

operations = [
migrations.RemoveField(
model_name='administrationunit',
name='import_id',
),
migrations.AddField(
model_name='administrationunit',
name='_import_id',
field=models.CharField(default='', max_length=15),
),
]
Loading

0 comments on commit 8d7bea1

Please sign in to comment.