Soory, it's a class, but it doesn't work properly neither. Do I have to introduce anything in urls.py? I haven't put anything because I want the listview in a url already created.
El lunes, 2 de febrero de 2015, 13:29:53 (UTC+1), elcaiaimar escribió:
-- El lunes, 2 de febrero de 2015, 13:29:53 (UTC+1), elcaiaimar escribió:
Hello everybody,
I'm working in a website using django. I would like that users could select and delete data introduced for them. I've found some information on the web and it seems that the ListView and DeleteView is what I need. However, when I try to do a ListView, it doesn't work and I don't know why.
Here my code:
models.py:
class Pozo(models.Model):
# gid_pozo = models.IntegerField(primary_key=True)
# gid_colector = models.ForeignKey(Colector)
codpozo = models.CharField(max_length=20)
coorx = models.DecimalField(max_digits=13, decimal_places=5)
coory = models.DecimalField(max_digits=13, decimal_places=5)
tipo = models.CharField(max_length=20)
cotatrapa = models.DecimalField(max_digits=6, decimal_places=2, default=None, blank=True, null=True)
profundidad = models.DecimalField(max_digits=6, decimal_places=2, default=None, blank=True, null=True)
cotafondo = models.DecimalField(max_digits=6, decimal_places=2, default=None, blank=True, null=True)
material = models.CharField(max_length=20)
materialpates = models.CharField(max_length=20)
diametro = models.DecimalField(max_digits=20, decimal_places=2, default=None, blank=True, null=True)
largotrapa = models.DecimalField(max_digits=20, decimal_places=2, default=None, blank=True, null=True)
seccionmayor = models.DecimalField(max_digits=5, decimal_places=0, default=None, blank=True, null=True)
seccionmenor = models.DecimalField(max_digits=5, decimal_places=0, default=None, blank=True, null=True)
numacometidas = models.DecimalField(max_digits=2, decimal_places=0, default=None, blank=True, null=True)
origen = models.CharField(max_length=20)
observaciones = models.CharField(max_length=255)
geom = models.PointField(srid=25830)
objects = models.GeoManager()
views.py:
def PozoList(ListView):
model = Pozo
template_name = 'cuencas/edicioncuenca.html'
template:
<select>
{% for pozo in object_list %}
<option>{{ pozo.codpozo }}</option>
{% endfor %}
</select>
And the result is a field without options. Does anybody know what I'm doing wrong?
Thank you very much!
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f3e6ef57-5a4f-4af5-a981-b364424bbc4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment