Commit da843ffd authored by Ale's avatar Ale

feat: Add address as field

parent 585fa91b
......@@ -27,8 +27,8 @@ class TestimonyAdmin(LeafletGeoAdmin):
model = models.Testimony
ordering = ('creation_date',)
list_display = ('name', 'summary', 'owner', 'creation_date', 'update_date')
fields = ( ('name', 'published'), 'category', 'other_categories', 'position', 'video')
fields = ( ('name', 'published'), 'category', 'other_categories', 'address', 'position', 'video')
admin.site.register(models.Testimony, TestimonyAdmin)
......
......@@ -13,16 +13,9 @@ class TestimonyForm(forms.ModelForm):
'name',
'category',
'other_categories',
'position',
'address',
'video'
]
widgets = {
'position' : GeocodedLeafletWidget(
submit_text=_('Buscar'),
provider="nominatim"
),
}
def __init__(self, *args, **kwargs):
super(TestimonyForm,self).__init__(*args, **kwargs)
......
......@@ -49,6 +49,16 @@ class Testimony(Publishable):
'Tu nombre o el nombre de tu historia.'
)
)
address = models.CharField(
_('Lugar'),
max_length = 128,
blank = False,
null = True,
help_text = _(
'¿Dónde sucede tu historia? Intenta aproximarte bastante, usaremos '
'esta dirección para situar tu historia en el mapa.'
)
)
position = PointField(
_('Sitúa tu historia'),
blank = False,
......@@ -79,7 +89,8 @@ class Testimony(Publishable):
related_name='other_posts',
blank=True,
help_text = _(
'¿Has visto nuestro glosario?'
'Manten presionado "Control" (o "Command" en un Mac) para seleccionar '
'más de una opción o deseleccionar elementos.'
)
)
summary = models.TextField(
......
......@@ -10,10 +10,6 @@
{% block header_end %}
<link rel="stylesheet" href="{% static '/map/js/node_modules/leaflet/dist/leaflet.css' %}" />
{% if form %}
{% leaflet_css plugins="forms" %}
{{ form.media }}
{% endif %}
{% endblock %}
{% block left %}
......@@ -118,7 +114,5 @@
{% endif %}
{% if form %}
<script type="text/javascript" src="{% static '/admin/js/vendor/jquery/jquery.min.js' %}"></script>
{% leaflet_js plugins="forms" %}
{{ form.media }}
{% endif %}
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment