I'm currently trying to implement a map within a form using class based model.
The map does not show on the page/form. The map, however, shows on the admin page
and stores the location successfully.
Any thoughts on where is the problem?
Model
from django.contrib.gis.db import models
class Property(models.Model):
....
location = models.PointField()
....
View
class PropertyCreate(CreateView):
form_class = PropertyForm
model = Property
form_class = PropertyForm
model = Property
.....
Forms
class PropertyForm(forms.ModelForm):
location = forms.PointField(widget=
forms.OSMWidget(attrs={'map_width': 800, 'map_height': 500}))
forms.OSMWidget(attrs={'map_width': 800, 'map_height': 500}))
class Meta:
model = Property
model = Property
Template
<form action="" method="post">
<div class="row">
<div class="col-md-8"> {{form.location }}</div>
</div>
<div class="row">
<div class="col-md-8"> {{form.location }}</div>
</div>
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e7d61f5d-7c5c-40dd-bfbc-28b032ac7263n%40googlegroups.com.
No comments:
Post a Comment