Browse Source

add integer-to-checkbox djula-filter (view.lisp).

stable
Craig Oates 2 years ago
parent
commit
f1c79a9ecd
  1. 13
      src/view.lisp

13
src/view.lisp

@ -49,3 +49,16 @@
:url-for))
(setf djula:*djula-execute-package* (find-package :ritherdon-archive.djula))
;; Custom filters and template code added below...
;; =============================================================================
;; This filter is for converting Integers used to store Boolean values
;; in a SQLite database. The intended place you will use this filter
;; is in the /software section. The most notable parts being the /add
;; and /edit sections. In the SQLite database, I have set:
;; - 0 => false
;; - 1 => true.
;; In this case, if the `VALUE' is not 1, it is always false (I.E. 0).
(djula::def-filter :integer-to-checkbox (value)
(format nil "~S" (if (= 1 value) "on" "off")))

Loading…
Cancel
Save