remande closed for archived
This commit is contained in:
parent
0ba3f6fad6
commit
abf9f31beb
18
lot/migrations/0008_rename_closed_lot_archived.py
Normal file
18
lot/migrations/0008_rename_closed_lot_archived.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 5.0.6 on 2025-02-25 12:32
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('lot', '0007_lottag_inbox'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name='lot',
|
||||||
|
old_name='closed',
|
||||||
|
new_name='archived',
|
||||||
|
),
|
||||||
|
]
|
|
@ -32,7 +32,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=False)
|
archived = 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,13 +7,13 @@
|
||||||
<h3>{{ subtitle }}</h3>
|
<h3>{{ subtitle }}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="col text-center">
|
<div class="col text-center">
|
||||||
{% if show_closed %}
|
{% if show_archived %}
|
||||||
<a href="?show_closed=false" class="btn btn-green-admin">
|
<a href="?show_archived=false" class="btn btn-green-admin">
|
||||||
{% trans 'Hide closed lots' %}
|
{% trans 'Hide archived lots' %}
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="?show_closed=true" class="btn btn-green-admin">
|
<a href="?show_archived=true" class="btn btn-green-admin">
|
||||||
{% trans 'Show closed lots' %}
|
{% trans 'Show archived lots' %}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
12
lot/views.py
12
lot/views.py
|
@ -25,7 +25,7 @@ class NewLotView(DashboardView, CreateView):
|
||||||
"name",
|
"name",
|
||||||
"code",
|
"code",
|
||||||
"description",
|
"description",
|
||||||
"closed",
|
"archived",
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_form(self):
|
def get_form(self):
|
||||||
|
@ -54,7 +54,7 @@ class DeleteLotView(DashboardView, DeleteView):
|
||||||
"name",
|
"name",
|
||||||
"code",
|
"code",
|
||||||
"description",
|
"description",
|
||||||
"closed",
|
"archived",
|
||||||
)
|
)
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
|
@ -73,7 +73,7 @@ class EditLotView(DashboardView, UpdateView):
|
||||||
"name",
|
"name",
|
||||||
"code",
|
"code",
|
||||||
"description",
|
"description",
|
||||||
"closed",
|
"archived",
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_form_kwargs(self):
|
def get_form_kwargs(self):
|
||||||
|
@ -149,15 +149,15 @@ 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)
|
||||||
show_closed = self.request.GET.get('show_closed', 'false') == 'true'
|
show_archived = self.request.GET.get('show_archived', 'false') == 'true'
|
||||||
lots = Lot.objects.filter(owner=self.request.user.institution).filter(
|
lots = Lot.objects.filter(owner=self.request.user.institution).filter(
|
||||||
type=tag, closed=show_closed
|
type=tag, archived=show_archived
|
||||||
)
|
)
|
||||||
context.update({
|
context.update({
|
||||||
'lots': lots,
|
'lots': lots,
|
||||||
'title': self.title,
|
'title': self.title,
|
||||||
'breadcrumb': self.breadcrumb,
|
'breadcrumb': self.breadcrumb,
|
||||||
'show_closed': show_closed
|
'show_archived': show_archived
|
||||||
})
|
})
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue