This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
htmx.on("htmx:afterSwap", function(evt) { | |
<Function_to_call>; | |
}); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import copy | |
import calendar | |
import pendulum as p | |
def getMonthDates(year:int, month:int, includeWeekends:bool = False) -> dict[list[p.datetime]]: | |
monthdates = list() | |
cal = calendar.Calendar() | |
dates = {} | |
monthdates = [] | |
for countweek, week in enumerate(cal.monthdatescalendar(year,month)): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def linkify(field_name): | |
""" | |
Converts a foreign key value into clickable links. | |
If field_name is 'parent', link text will be str(obj.parent) | |
Link will be admin url for the admin url for obj.parent.id:change | |
""" | |
def _linkify(obj): | |
linked_obj = getattr(obj, field_name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
document.body.addEventListener('htmx:configRequest', (event) => { | |
event.detail.headers['X-CSRFToken'] = '{{ csrf_token }}'; | |
}) | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% crispy form %} | |
<form action="{% url 'form handler url' %}" class="uniForm" method="post"> | |
{% crispy first_form %} | |
{% crispy second_form %} | |
</form> |