Skip to content

Commit

Permalink
Merge pull request #162 from manuGil/frontend/mapviews
Browse files Browse the repository at this point in the history
Frontend/mapviews
  • Loading branch information
manuGil authored Nov 20, 2024
2 parents 6a1b047 + c505498 commit 293a184
Show file tree
Hide file tree
Showing 39 changed files with 4,759 additions and 2,268 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ __pycache__/

# NOTES
dev-notes.md
data/

# Django #
*.log
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0 on 2024-06-12 14:28

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('apiapp', '0002_polygonfeature'),
]

operations = [
migrations.RenameField(
model_name='locationcollection',
old_name='descripion',
new_name='description',
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0 on 2024-06-19 01:19

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('apiapp', '0003_rename_descripion_locationcollection_description'),
]

operations = [
migrations.AlterField(
model_name='locationcollection',
name='description',
field=models.CharField(blank=True, max_length=300, null=True),
),
]
18 changes: 18 additions & 0 deletions citizenvoice/apiapp/migrations/0005_question_show_text.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0 on 2024-06-26 05:45

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('apiapp', '0004_alter_locationcollection_description'),
]

operations = [
migrations.AddField(
model_name='question',
name='show_text',
field=models.BooleanField(default=True, verbose_name='If the question must show the text field or not'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 5.0 on 2024-06-26 06:18

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('apiapp', '0005_question_show_text'),
]

operations = [
migrations.AddField(
model_name='question',
name='explanation',
field=models.TextField(blank=True, null=True, verbose_name='Explanation for the Question'),
),
migrations.AlterField(
model_name='question',
name='show_text',
field=models.BooleanField(default=True, verbose_name='Show the input text field'),
),
migrations.AlterField(
model_name='question',
name='text',
field=models.TextField(verbose_name='Question'),
),
]
18 changes: 18 additions & 0 deletions citizenvoice/apiapp/migrations/0007_alter_question_explanation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0 on 2024-06-26 07:09

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('apiapp', '0006_question_explanation_alter_question_show_text_and_more'),
]

operations = [
migrations.AlterField(
model_name='question',
name='explanation',
field=models.TextField(blank=True, max_length=200, null=True, verbose_name='Explanation for the question'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Generated by Django 5.0 on 2024-07-03 09:24

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('apiapp', '0007_alter_question_explanation'),
]

operations = [
migrations.RenameField(
model_name='question',
old_name='show_text',
new_name='has_text_input',
),
migrations.RemoveField(
model_name='linefeature',
name='description',
),
migrations.RemoveField(
model_name='pointfeature',
name='description',
),
migrations.RemoveField(
model_name='polygonfeature',
name='description',
),
migrations.AddField(
model_name='linefeature',
name='annotation',
field=models.CharField(blank=True, max_length=150, null=True),
),
migrations.AddField(
model_name='mapview',
name='description',
field=models.TextField(blank=True, max_length=200, null=True, verbose_name='Description of the MapView'),
),
migrations.AddField(
model_name='pointfeature',
name='annotation',
field=models.CharField(blank=True, max_length=150, null=True),
),
migrations.AddField(
model_name='polygonfeature',
name='annotation',
field=models.CharField(blank=True, max_length=150, null=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 5.0 on 2024-07-03 11:45

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


class Migration(migrations.Migration):

dependencies = [
('apiapp', '0008_rename_show_text_question_has_text_input_and_more'),
]

operations = [
migrations.AlterField(
model_name='linefeature',
name='location',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apiapp.locationcollection'),
),
migrations.AlterField(
model_name='pointfeature',
name='location',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apiapp.locationcollection'),
),
migrations.AlterField(
model_name='polygonfeature',
name='location',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apiapp.locationcollection'),
),
]
18 changes: 18 additions & 0 deletions citizenvoice/apiapp/migrations/0010_survey_submit_messsage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0 on 2024-07-03 11:56

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('apiapp', '0009_alter_linefeature_location_and_more'),
]

operations = [
migrations.AddField(
model_name='survey',
name='submit_messsage',
field=models.TextField(blank=True, default='Thank you for your participation!', verbose_name='Message to be displayed after survey is submited'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0 on 2024-07-03 11:59

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('apiapp', '0010_survey_submit_messsage'),
]

operations = [
migrations.RenameField(
model_name='survey',
old_name='submit_messsage',
new_name='submit_message',
),
]
18 changes: 18 additions & 0 deletions citizenvoice/apiapp/migrations/0012_alter_survey_submit_message.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0 on 2024-07-03 12:01

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('apiapp', '0011_rename_submit_messsage_survey_submit_message'),
]

operations = [
migrations.AlterField(
model_name='survey',
name='submit_message',
field=models.TextField(blank=True, default='Thank you for your participation!', verbose_name='Message to be displayed after survey is submitted'),
),
]
15 changes: 7 additions & 8 deletions citizenvoice/apiapp/models/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,24 @@ class PointFeature(gis_models.Model) :
Represents the location of a question or answer as a POINT
"""
geom = gis_models.PointField()
description = models.CharField(max_length=100, blank=True, null=True)
location = models.ForeignKey('LocationCollection', on_delete=models.RESTRICT)
annotation = models.CharField(max_length=150, blank=True, null=True)
location = models.ForeignKey('LocationCollection', on_delete=models.CASCADE)

class PolygonFeature(gis_models.Model):
"""
Represents the location of a question or answer as a POLYGON
"""
geom = gis_models.PolygonField()
description = models.CharField(max_length=100, blank=True, null=True)
location = models.ForeignKey('LocationCollection', on_delete=models.RESTRICT)

annotation = models.CharField(max_length=150, blank=True, null=True)
location = models.ForeignKey('LocationCollection', on_delete=models.CASCADE)

class LineFeature(gis_models.Model):
"""
Represents the location of a question or answer as a LINESTRING
"""
geom = gis_models.LineStringField()
description = models.CharField(max_length=100, blank=True, null=True)
location = models.ForeignKey('LocationCollection', on_delete=models.RESTRICT)
annotation = models.CharField(max_length=150, blank=True, null=True)
location = models.ForeignKey('LocationCollection', on_delete=models.CASCADE)


class LocationCollection(models.Model):
Expand All @@ -41,7 +40,7 @@ class for representing geographic locations of
"""

name = models.CharField(max_length=100, blank=True)
descripion = models.CharField(max_length=300, blank=True)
description = models.CharField(max_length=300, blank=True, null=True)

def __str__(self):
"Returs the name of the location"
Expand Down
1 change: 1 addition & 0 deletions citizenvoice/apiapp/models/mapview.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class MapView(models.Model):
"""
name = models.CharField(_("Name of the MapView location"), max_length=150, blank=True, default="Delft")
map_service_url = models.CharField(_("Map Service URL"), max_length=150, default=default_service_url)
description = models.TextField(_("Description of the MapView"), max_length=200, blank=True, null=True)
options = models.JSONField(_("Map service specific options"), default=default_options)
location = models.ForeignKey(LocationCollection, on_delete=models.SET_NULL, blank=True, null=True)

Expand Down
16 changes: 9 additions & 7 deletions citizenvoice/apiapp/models/question.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ class Question(models.Model):
(DATE, _("date")),
)

text = models.TextField(_("Text of the Question"))
text = models.TextField(_("Question"))
explanation = models.TextField(_("Explanation for the question"), max_length=200, blank=True, null=True)
order = models.IntegerField(_("Order of where question is placed"))
required = models.BooleanField(_("Question must be filled out"), default=True)
has_text_input = models.BooleanField(_("Show the input text field"), default=True)
question_type = models.CharField(_("Type of question"), max_length=150, choices=QUESTION_TYPES, default=TEXT)
choices = models.TextField(_("Choices for answers"), blank=True, null=True)
survey = models.ForeignKey(Survey, on_delete=models.CASCADE, default=1)
Expand All @@ -66,10 +68,10 @@ def question_count(self):
return self.question_set.count()


class Meta:
verbose_name = _("question")
verbose_name_plural = _("questions")
ordering = ("survey", "order")
# class Meta:
# verbose_name = _("question")
# verbose_name_plural = _("questions")
# ordering = ("survey", "order")

def question_count(self):
return self.question_set.count()
# def question_count(self):
# return self.question_set.count()
1 change: 1 addition & 0 deletions citizenvoice/apiapp/models/survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Survey(models.Model):
is_published = models.BooleanField(_("Survey is visible and accessible to users"), default=False)
need_logged_user = models.BooleanField(_("Only authenticated users have access to this survey"), default=False)
editable_answers = models.BooleanField(_("Answers can be edited after submission"), default=True)
submit_message = models.TextField(_("Message to be displayed after survey is submitted"), blank=True, default="Thank you for your participation!")
publish_date = models.DateTimeField(_("Date that survey was made available"))
expire_date = models.DateTimeField(_("Expiry date of survey"))
public_url = models.CharField(_("Public URL"), max_length=255, blank=True) # TODO: [manuel] this should be auto-generated when chosen by the designer
Expand Down
Loading

0 comments on commit 293a184

Please sign in to comment.