Skip to content

Commit

Permalink
Merge pull request #155 from robertatakenaka/tk_154
Browse files Browse the repository at this point in the history
Remove o campo `action` de Educação e garante que cada diretório tenh…
  • Loading branch information
gitnnolabs authored Feb 15, 2023
2 parents 688c343 + 3621f5b commit 82ca16b
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 3.2.12 on 2023-02-15 18:43

from django.db import migrations, models
import django.db.models.deletion
import education_directory.models


class Migration(migrations.Migration):

dependencies = [
('usefulmodels', '0011_auto_20221108_2356'),
('education_directory', '0002_alter_educationdirectory_record_status'),
]

operations = [
migrations.AlterField(
model_name='educationdirectory',
name='action',
field=models.ForeignKey(blank=True, default=education_directory.models.get_default_action, null=True, on_delete=django.db.models.deletion.SET_NULL, to='usefulmodels.action', verbose_name='Ação'),
),
]
18 changes: 16 additions & 2 deletions education_directory/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@

from . import choices


def get_default_action():
try:
return Action.objects.get(name__icontains="educa")
except Action.DoesNotExist:
return None


class EducationDirectory(CommonControlField):
class Meta:
verbose_name_plural = _('Education Directory')
Expand All @@ -39,7 +47,14 @@ class Meta:

practice = models.ForeignKey(Practice, verbose_name=_("Practice"),
null=True, blank=True, on_delete=models.SET_NULL)
action = models.ForeignKey(Action, verbose_name=_("Action"), null=True, blank=True, on_delete=models.SET_NULL)
action = models.ForeignKey(
Action,
verbose_name=_("Action"),
null=True,
blank=True,
on_delete=models.SET_NULL,
default=get_default_action,
)

classification = models.CharField(_("Classification"), choices=choices.classification,
max_length=255, null=True, blank=True)
Expand Down Expand Up @@ -75,7 +90,6 @@ class Meta:
FieldPanel('keywords'),
FieldPanel('classification'),
FieldPanel('practice'),
FieldPanel('action'),

FieldPanel('attendance'),
FieldPanel('record_status'),
Expand Down
21 changes: 21 additions & 0 deletions event_directory/migrations/0004_alter_eventdirectory_action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 3.2.12 on 2023-02-15 18:43

from django.db import migrations, models
import django.db.models.deletion
import event_directory.models


class Migration(migrations.Migration):

dependencies = [
('usefulmodels', '0011_auto_20221108_2356'),
('event_directory', '0003_alter_eventdirectory_organization'),
]

operations = [
migrations.AlterField(
model_name='eventdirectory',
name='action',
field=models.ForeignKey(blank=True, default=event_directory.models.get_default_action, null=True, on_delete=django.db.models.deletion.SET_NULL, to='usefulmodels.action', verbose_name='Ação'),
),
]
16 changes: 15 additions & 1 deletion event_directory/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
from .forms import EventDirectoryFileForm, EventDirectoryForm


def get_default_action():
try:
return Action.objects.get(name__icontains="disseminação")
except Action.DoesNotExist:
return None


class EventDirectory(CommonControlField):
class Meta:
verbose_name_plural = _('EventDirectory Directory')
Expand All @@ -40,7 +47,14 @@ class Meta:

practice = models.ForeignKey(Practice, verbose_name=_("Practice"),
null=True, blank=True, on_delete=models.SET_NULL)
action = models.ForeignKey(Action, verbose_name=_("Action"), null=True, blank=True, on_delete=models.SET_NULL)
action = models.ForeignKey(
Action,
verbose_name=_("Action"),
null=True,
blank=True,
on_delete=models.SET_NULL,
default=get_default_action,
)

classification = models.CharField(_("Classification"), choices=choices.classification,
max_length=255, null=True, blank=True)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 3.2.12 on 2023-02-15 18:43

from django.db import migrations, models
import django.db.models.deletion
import infrastructure_directory.models


class Migration(migrations.Migration):

dependencies = [
('usefulmodels', '0011_auto_20221108_2356'),
('infrastructure_directory', '0002_alter_infrastructuredirectory_record_status'),
]

operations = [
migrations.AlterField(
model_name='infrastructuredirectory',
name='action',
field=models.ForeignKey(blank=True, default=infrastructure_directory.models.get_default_action, null=True, on_delete=django.db.models.deletion.SET_NULL, to='usefulmodels.action', verbose_name='Ação'),
),
]
17 changes: 15 additions & 2 deletions infrastructure_directory/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
from .forms import InfrastructureDirectoryFileForm, InfrastructureDirectoryForm


def get_default_action():
try:
return Action.objects.get(name__icontains="infra")
except Action.DoesNotExist:
return None


class InfrastructureDirectory(CommonControlField):
class Meta:
verbose_name_plural = _('Infraestructure Directory')
Expand All @@ -29,8 +36,14 @@ class Meta:

practice = models.ForeignKey(Practice, verbose_name=_("Practice"),
null=True, blank=True, on_delete=models.SET_NULL)
action = models.ForeignKey(Action, verbose_name=_("Action"), null=True, blank=True, on_delete=models.SET_NULL)

action = models.ForeignKey(
Action,
verbose_name=_("Action"),
null=True,
blank=True,
on_delete=models.SET_NULL,
default=get_default_action,
)

classification = models.CharField(_("Classification"), choices=choices.classification,
max_length=255, null=True, blank=True)
Expand Down
21 changes: 21 additions & 0 deletions policy_directory/migrations/0004_alter_policydirectory_action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 3.2.12 on 2023-02-15 18:43

from django.db import migrations, models
import django.db.models.deletion
import policy_directory.models


class Migration(migrations.Migration):

dependencies = [
('usefulmodels', '0011_auto_20221108_2356'),
('policy_directory', '0003_alter_policydirectory_date'),
]

operations = [
migrations.AlterField(
model_name='policydirectory',
name='action',
field=models.ForeignKey(blank=True, default=policy_directory.models.get_default_action, null=True, on_delete=django.db.models.deletion.SET_NULL, to='usefulmodels.action', verbose_name='Ação'),
),
]
17 changes: 16 additions & 1 deletion policy_directory/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@

from . import choices


def get_default_action():
try:
return Action.objects.get(name__icontains="políticas")
except Action.DoesNotExist:
return None


class PolicyDirectory(CommonControlField):
class Meta:
verbose_name_plural = _('Policy Directory')
Expand All @@ -31,7 +39,14 @@ class Meta:

practice = models.ForeignKey(Practice, verbose_name=_("Practice"),
null=True, blank=True, on_delete=models.SET_NULL)
action = models.ForeignKey(Action, verbose_name=_("Action"), null=True, blank=True, on_delete=models.SET_NULL)
action = models.ForeignKey(
Action,
verbose_name=_("Action"),
null=True,
blank=True,
on_delete=models.SET_NULL,
default=get_default_action,
)

classification = models.CharField(_("Classification"), choices=choices.classification,
max_length=255, null=True, blank=True)
Expand Down

0 comments on commit 82ca16b

Please sign in to comment.