Compare commits
2 Commits
9badf494a6
...
a9e39dcd3d
Author | SHA1 | Date |
---|---|---|
cayop | a9e39dcd3d | |
pedro | 6e4bb3729f |
|
@ -31,7 +31,7 @@ class Lot(models.Model):
|
||||||
name = models.CharField(max_length=STR_SIZE, blank=True, null=True)
|
name = models.CharField(max_length=STR_SIZE, blank=True, null=True)
|
||||||
code = 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)
|
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)
|
owner = models.ForeignKey(Institution, on_delete=models.CASCADE)
|
||||||
user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True)
|
user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True)
|
||||||
type = models.ForeignKey(LotTag, on_delete=models.CASCADE)
|
type = models.ForeignKey(LotTag, on_delete=models.CASCADE)
|
||||||
|
|
|
@ -7,6 +7,16 @@
|
||||||
<h3>{{ subtitle }}</h3>
|
<h3>{{ subtitle }}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="col text-center">
|
<div class="col text-center">
|
||||||
|
{% if show_closed %}
|
||||||
|
<a href="?show_closed=false" class="btn btn-green-admin">
|
||||||
|
{% trans 'Hide closed lots' %}
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="?show_closed=true" class="btn btn-green-admin">
|
||||||
|
{% trans 'Show closed lots' %}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<a href="{% url 'lot:add' %}" type="button" class="btn btn-green-admin">
|
<a href="{% url 'lot:add' %}" type="button" class="btn btn-green-admin">
|
||||||
<i class="bi bi-plus"></i>
|
<i class="bi bi-plus"></i>
|
||||||
{% trans 'Add new lot' %}
|
{% trans 'Add new lot' %}
|
||||||
|
|
|
@ -131,11 +131,13 @@ class LotsTagsView(DashboardView, TemplateView):
|
||||||
tag = get_object_or_404(LotTag, owner=self.request.user.institution, id=self.pk)
|
tag = get_object_or_404(LotTag, owner=self.request.user.institution, id=self.pk)
|
||||||
self.title += " {}".format(tag.name)
|
self.title += " {}".format(tag.name)
|
||||||
self.breadcrumb += " {}".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({
|
context.update({
|
||||||
'lots': lots,
|
'lots': lots,
|
||||||
'title': self.title,
|
'title': self.title,
|
||||||
'breadcrumb': self.breadcrumb
|
'breadcrumb': self.breadcrumb,
|
||||||
|
'show_closed': show_closed
|
||||||
})
|
})
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue