Skip to content

Add an example project - #14

Merged
bpepple merged 2 commits into
mainfrom
example-app
Nov 2, 2026
Merged

bpepple merged 2 commits into
mainfrom
example-app

Conversation

@bpepple

@bpepple bpepple commented Nov 2, 2026

Copy link
Copy Markdown
Member

Adds a small Django project in example/ so users can see LookupWidget working before they wire it into their own app. It's a comics catalogue: one form edits an issue's series, language and characters.

What it shows

  • SeriesLookup on a ForeignKey, with rank_fields, a custom label, select_related and max_results = 10. Searching "man" demonstrates both ranking and the cut-off message.
  • CharacterLookup on a ManyToManyField with multiple=True, searching name and alias.
  • LanguageLookup, a plain Lookup over a list, on a CharField with choices. The model field's choices still validate the submitted value.
  • IZAYA_CLASSES and a small stylesheet that put the selected values inside the search box. The form page also logs izaya:select and izaya:remove events.

Running it

uv sync
uv run example/manage.py migrate      # also loads sample data
uv run example/manage.py runserver

The page loads htmx 2.0.11 from jsdelivr, so it needs a network connection.

Other changes

  • pyproject.toml: per-file ruff ignores for example/, like the existing ones for tests/*.
  • .gitignore: ignores example/db.sqlite3.
  • README.md links to the example, and CHANGELOG.md has an entry under Unreleased.

The example isn't packaged, because the build only includes izaya/. CI doesn't run it either.

A small comics catalogue in example/ that shows LookupWidget on a ForeignKey, a ManyToManyField and a CharField with choices, using lookups over models and over a plain list. Migrating loads sample data to search. Its styles show the selected values inside the search box.
@bpepple bpepple self-assigned this Nov 2, 2026
@bpepple bpepple added enhancement New feature or request patch chore and removed enhancement New feature or request labels Nov 2, 2026
@bpepple
bpepple merged commit 0634523 into main Nov 2, 2026
6 checks passed
@bpepple
bpepple deleted the example-app branch November 2, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant