diff --git a/app/forms.py b/app/forms.py index 43fd8b5..50f7f34 100644 --- a/app/forms.py +++ b/app/forms.py @@ -8,7 +8,7 @@ class ProfileUpdateForm(ModelForm): class Meta: model = Profile - fields = ["description", "tags"] + fields = ["description", "tags", "country", "city"] hidden_fields = ["longitude", "latitude"] def __init__(self, *args, **kwargs): diff --git a/app/migrations/0014_auto_20200927_1620.py b/app/migrations/0014_auto_20200927_1620.py new file mode 100644 index 0000000..d6ff634 --- /dev/null +++ b/app/migrations/0014_auto_20200927_1620.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1 on 2020-09-27 20:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('app', '0013_auto_20200919_0144'), + ] + + operations = [ + migrations.AddField( + model_name='profile', + name='city', + field=models.CharField(blank=True, help_text='City of origin of user', max_length=30, null=True, verbose_name='city'), + ), + migrations.AddField( + model_name='profile', + name='country', + field=models.CharField(blank=True, help_text='Country of origin of user', max_length=30, null=True, verbose_name='country'), + ), + ] diff --git a/app/models.py b/app/models.py index df43de6..45d0f5d 100644 --- a/app/models.py +++ b/app/models.py @@ -87,6 +87,8 @@ class Profile(models.Model): description = models.TextField( blank=True, verbose_name="Description", help_text="User description." ) + country = models.CharField(blank=True, null=True, max_length=30, verbose_name="country", help_text="Country of origin of user") + city = models.CharField(blank=True, null=True,max_length=30, verbose_name="city", help_text="City of origin of user") badges = models.ManyToManyField( Badge, blank=True, @@ -109,7 +111,6 @@ def username(self): def __str__(self): return self.user.username - class Challenge(models.Model): name = models.CharField( max_length=100, verbose_name="Name", help_text="Name of this challenge." diff --git a/app/static/css/style.css b/app/static/css/style.css index dff4dbc..c2876a7 100644 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -224,8 +224,22 @@ footer { justify-items: center; } +#geocoder { + position: relative; + z-index: 1; + width: 50%; + left: 50%; + margin-left: -25%; + top: 10px; +} + +.mapboxgl-ctrl-geocoder { + min-width: 100%; + margin-left:10%; +} + #map { - height: 50vh; + margin-top: 75px; } .form-section > label { diff --git a/app/static/js/map.js b/app/static/js/map.js deleted file mode 100644 index 4f817b7..0000000 --- a/app/static/js/map.js +++ /dev/null @@ -1,23 +0,0 @@ -mapboxgl.accessToken = 'pk.eyJ1IjoibmlraXN1IiwiYSI6ImNrZWdla2NvOTB1MWIyeHVxN3lrZmExb3EifQ._NPc57J623HhSRubXYPcIg'; -var coordinates = document.getElementById('map'); -var map = new mapboxgl.Map({ - container: 'map', - style: 'mapbox://styles/mapbox/dark-v10', - center: [0, 0], - zoom: 2 -}); - -var marker = new mapboxgl.Marker({ - draggable: true - }) - .setLngLat([0, 0]) - .addTo(map); - -function onDragEnd() { - var lngLat = marker.getLngLat(); - // coordinates.style.display = 'block'; - // coordinates.innerHTML = - // 'Longitude: ' + lngLat.lng + '
Latitude: ' + lngLat.lat; -} - -marker.on('dragend', onDragEnd); \ No newline at end of file diff --git a/app/templates/base.html b/app/templates/base.html index 8f3089b..2adc50d 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -20,6 +20,12 @@ + + + + + + {% block head %} {% endblock %} diff --git a/app/templates/challenge.html b/app/templates/challenge.html index 90b7d58..dcac6aa 100644 --- a/app/templates/challenge.html +++ b/app/templates/challenge.html @@ -13,11 +13,11 @@

Heat map

Contributions by region

-
+

Projects posted to this challenge

@@ -43,7 +43,7 @@

Projects posted to this challenge

-

{{ project.description|truncatechars(80) }}

+

{{ project.one_liner|truncatechars(80) }}

-
+
- diff --git a/app/templates/explore.html b/app/templates/explore.html index 17803f3..58964d4 100644 --- a/app/templates/explore.html +++ b/app/templates/explore.html @@ -79,7 +79,7 @@

{{ name|title }}s

-

{{ object.description|truncatechars(48) }}

+

{{ object.one_liner|truncatechars(48) }}