diff --git a/lot/models.py b/lot/models.py
index 764e134..6c81bfd 100644
--- a/lot/models.py
+++ b/lot/models.py
@@ -31,7 +31,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)
user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True)
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 e9bb081..182aade 100644
--- a/lot/views.py
+++ b/lot/views.py
@@ -131,11 +131,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