Skip to content

Commit

Permalink
feat: added UseCase.published field #191
Browse files Browse the repository at this point in the history
  • Loading branch information
csae8092 committed Jan 16, 2023
1 parent 0ef107d commit 9fac33f
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 3 deletions.
2 changes: 1 addition & 1 deletion archiv/api_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class SlideViewSet(viewsets.ModelViewSet):


class UseCaseViewSet(viewsets.ModelViewSet):
queryset = UseCase.objects.all().distinct()
queryset = UseCase.objects.filter(published=True).distinct()
serializer_class = UseCaseSerializer
filter_backends = [
django_filters.rest_framework.DjangoFilterBackend,
Expand Down
1 change: 1 addition & 0 deletions archiv/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class Meta:
"id",
"show_labels",
"layer",
"published",
]


Expand Down
18 changes: 18 additions & 0 deletions archiv/fixtures/dump.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions archiv/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def __init__(self, *args, **kwargs):
"title",
"principal_investigator",
"show_labels",
"published",
css_id="basic_search_fields",
),
Accordion(
Expand Down
18 changes: 18 additions & 0 deletions archiv/migrations/0047_usecase_published.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.0.7 on 2023-01-16 12:50

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('archiv', '0046_remove_stelle_ort'),
]

operations = [
migrations.AddField(
model_name='usecase',
name='published',
field=models.BooleanField(default=False, help_text='True if the use case should be presented in the frontend, false if not', verbose_name='Published'),
),
]
5 changes: 5 additions & 0 deletions archiv/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ class UseCase(models.Model):
verbose_name="Show Labels",
help_text="True if labels of the Spatial Coverage should be visible in the front end"
)
published = models.BooleanField(
default=False,
verbose_name="Published",
help_text="True if the use case should be presented in the frontend, false if not"
)

class Meta:

Expand Down
6 changes: 5 additions & 1 deletion create_fixtures.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ python manage.py dump_object archiv.keyword 28 > fixtures_keyword.json
echo "create fixtures_layer"
python manage.py dump_object layers.geojsonlayer 7 3 > fixtures_layer.json

echo "create fixtures_usecase"
python manage.py dump_object archiv.usecase 14 > fixtures_usecase.json

echo "merging fixtures"
python manage.py merge_fixtures fixtures_stelle.json fixtures_spatialcoverage.json fixtures_keyword.json fixtures_layer.json > archiv/fixtures/dump.json
python manage.py merge_fixtures fixtures_stelle.json fixtures_spatialcoverage.json fixtures_keyword.json fixtures_layer.json fixtures_usecase.json > archiv/fixtures/dump.json

echo "delete fixtures"
rm fixtures_keyword.json
rm fixtures_spatialcoverage.json
rm fixtures_stelle.json
rm fixtures_layer.json
rm fixtures_usecase.json

echo "done"
2 changes: 1 addition & 1 deletion djangobaseproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
]
if DEBUG:
INSTALLED_APPS.insert(10, "django_extensions")
# INSTALLED_APPS.insert(11, 'fixture_magic')
INSTALLED_APPS.insert(11, 'fixture_magic')

CRISPY_TEMPLATE_PACK = "bootstrap4"
SPAGHETTI_SAUCE = {
Expand Down

0 comments on commit 9fac33f

Please sign in to comment.