important-winter-64905
02/21/2022, 1:01 PMclass="update_flash"
and used only one style:
td.update_flash.htmx-settling {
background: #36842d;
}
If the initial state of class
was anything except update_flash
it would not work. After HTMX swapped in the class would be changed to update_flash
and so it would then do the flash when the swap was done.
As it is now, the class is class="update_flash {{ update_color }}"
. On first load of the page this is class="update_flash"
which has no defined css.
When I do the swap, it will change to class="update_flash update_green"
. When this is done the first time, nothing happens. If I submit again, it will flash green. Similarly, if I submit something to flash red, it will only flash the second time the update_red
class is inserted.
This makes me believe the preexisting state has to include the class attribute you are trying to trigger but I don't want to add both and trigger both because people can enter data multiple times to the same form. Sometimes it should flash green and other times it should flash red.mysterious-toddler-20573
02/21/2022, 1:36 PMhundreds-camera-24900
02/21/2022, 11:56 PMhundreds-camera-24900
02/21/2022, 11:56 PMhundreds-camera-24900
02/21/2022, 11:56 PMrich-arm-7401
02/22/2022, 8:33 PM{% for campaign in campaigns %}
{% if forloop.counter0|divisibleby:4%}
<div class="row">
{% endif %}
<div class="col col-xl-3 col-lg-3 col-md-3 mb-4 col-sm-6">
<div hx-get="{{object.get_detail_url}}" hx-target="#galleryContent" hx-swap="outerHTML"
hx-trigger="click" class="card bg-white rounded shadow" data-bs-toggle="modal"
data-bs-target="#GalleryModal">
<img class="img-fluid card-img-top"
src="{{ object.image.url }}">
<div class="p-4">
<h1 class="fs-5 text-dark" href="#">{{ object.title}}</h1>
<p class="small text-muted mb-0">{{object.description |truncatechars:75}}</p>
<div class="row mt-4">
<div class="col col-md-12 col-sm-12 col-lg-6 col-12">
<p class="small mb-0"><i class="fas fa-hashtag me-2"></i><span
class="fw-bold">ART</span></p>
</div>
<div class="col col-md-12 col-sm-12 col-lg-6">
<div class="badge rounded-pill bg-danger px-3 fw-normal"><span>New</span></div>
{% comment "" %}
TODO: Add loging for trends and tags
{% endcomment %}
</div>
</div>
</div>
</div>
</div>
{% if forloop.counter|divisibleby:4 or forloop.last %}
</div>
{% endif %}
{% endfor %}
brave-magazine-28098
02/22/2022, 8:36 PMrich-arm-7401
02/22/2022, 8:38 PMhtmx:targetError 9 htmx.org@1.6.1:1:19609
ut https://unpkg.com/htmx.org@1.6.1:1
lt https://unpkg.com/htmx.org@1.6.1:1
ot https://unpkg.com/htmx.org@1.6.1:1
Zt https://unpkg.com/htmx.org@1.6.1:1
i https://unpkg.com/htmx.org@1.6.1:1
(Async: EventListener.handleEvent)
ke https://unpkg.com/htmx.org@1.6.1:1
B https://unpkg.com/htmx.org@1.6.1:1
ke https://unpkg.com/htmx.org@1.6.1:1
Ze https://unpkg.com/htmx.org@1.6.1:1
Ze https://unpkg.com/htmx.org@1.6.1:1
B https://unpkg.com/htmx.org@1.6.1:1
Ze https://unpkg.com/htmx.org@1.6.1:1
tt https://unpkg.com/htmx.org@1.6.1:1
rt https://unpkg.com/htmx.org@1.6.1:1
B https://unpkg.com/htmx.org@1.6.1:1
rt https://unpkg.com/htmx.org@1.6.1:1
<anonymous> https://unpkg.com/htmx.org@1.6.1:1
(Async: EventListener.handleEvent)
rr https://unpkg.com/htmx.org@1.6.1:1
<anonymous> https://unpkg.com/htmx.org@1.6.1:1
<anonymous> https://unpkg.com/htmx.org@1.6.1:1
<anonymous> https://unpkg.com/htmx.org@1.6.1:1
<anonymous> https://unpkg.com/htmx.org@1.6.1:1
rich-arm-7401
02/22/2022, 8:45 PMrich-arm-7401
02/22/2022, 8:49 PMbrave-magazine-28098
02/22/2022, 8:50 PMmysterious-toddler-20573
02/23/2022, 12:37 AMimportant-winter-64905
02/23/2022, 6:59 PMhundreds-camera-24900
02/23/2022, 7:01 PMhundreds-camera-24900
02/23/2022, 7:01 PMimportant-winter-64905
02/23/2022, 8:54 PMhundreds-camera-24900
02/23/2022, 8:54 PMhundreds-camera-24900
02/23/2022, 8:55 PMimportant-winter-64905
02/23/2022, 9:31 PMimportant-winter-64905
02/23/2022, 9:31 PMblue-gold-89534
02/23/2022, 11:20 PMbland-coat-6833
02/24/2022, 9:57 AMbland-coat-6833
02/24/2022, 9:58 AMblue-gold-89534
02/24/2022, 10:47 AMblue-gold-89534
02/25/2022, 10:09 AMwhite-motorcycle-95262
02/25/2022, 9:04 PMfresh-judge-74869
02/26/2022, 5:39 AMblue-gold-89534
02/26/2022, 8:17 AMfresh-judge-74869
02/26/2022, 1:11 PMprefix="main"
fresh-judge-74869
02/26/2022, 1:14 PMclass OrderForm(forms.ModelForm):
class Meta:
model = Order
fields = (
"company",
"project",
"client",
)
labels = {
"company": "Compañía",
"project": "Proyecto",
"client": "Cliente",
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["project"].queryset = Project.objects.none()
self.fields["client"].queryset = ClientProfile.objects.none()
if "company" in self.data:
try:
company_id = int(self.data.get("main-company"))
print("running:", company_id)
self.fields["project"].queryset = Project.objects.filter(
company_id=company_id
).order_by("name")
self.fields["client"].queryset = ClientProfile.objects.filter(
company_id=company_id
).order_by("name")
except (ValueError, TypeError):
pass
elif self.instance.pk:
self.fields[
"project"
].queryset = self.instance.company.project_set.order_by("name")
self.fields[
"client"
].queryset = self.instance.company.clientprofile_set.order_by("user__first_name")
Here when I take out the __init__ func the form works fine in create and update mode, but in the options os the proyect and client are populated with all data with out fittering