diff --git a/lot/models.py b/lot/models.py
index 3926f29..7b95230 100644
--- a/lot/models.py
+++ b/lot/models.py
@@ -30,7 +30,7 @@ class Lot(models.Model):
name = models.CharField(max_length=STR_SIZE, blank=True, null=True)
code = models.CharField(max_length=STR_SIZE, blank=True, null=True)
description = models.CharField(max_length=STR_SIZE, blank=True, null=True)
- closed = models.BooleanField(default=True)
+ closed = models.BooleanField(default=False)
owner = models.ForeignKey(Institution, on_delete=models.CASCADE)
type = models.ForeignKey(LotTag, on_delete=models.CASCADE)
diff --git a/lot/templates/lots.html b/lot/templates/lots.html
index e091dd4..2aa866d 100644
--- a/lot/templates/lots.html
+++ b/lot/templates/lots.html
@@ -7,6 +7,16 @@
{{ subtitle }}
+ {% if show_closed %}
+
+ {% trans 'Hide closed lots' %}
+
+ {% else %}
+
+ {% trans 'Show closed lots' %}
+
+ {% endif %}
+
{% trans 'Add new lot' %}
diff --git a/lot/views.py b/lot/views.py
index 46252c8..a9aafb6 100644
--- a/lot/views.py
+++ b/lot/views.py
@@ -126,11 +126,13 @@ class LotsTagsView(DashboardView, TemplateView):
tag = get_object_or_404(LotTag, owner=self.request.user.institution, id=self.pk)
self.title += " {}".format(tag.name)
self.breadcrumb += " {}".format(tag.name)
- lots = Lot.objects.filter(owner=self.request.user.institution).filter(type=tag)
+ show_closed = self.request.GET.get('show_closed', 'false') == 'true'
+ lots = Lot.objects.filter(owner=self.request.user.institution).filter(type=tag, closed=show_closed)
context.update({
'lots': lots,
'title': self.title,
- 'breadcrumb': self.breadcrumb
+ 'breadcrumb': self.breadcrumb,
+ 'show_closed': show_closed
})
return context