Tags ~~~~ Views advertise themselves to introspected menus with a ``tags`` attribute. Well-known constants are :class:`~djcrud.tags.Tag` instances and compare equal to their string names. Call a constant to set a ``position`` (list-style indexing: ``0`` is first, ``-1`` is last); custom tags are plain strings, or :class:`~djcrud.tags.Tag` when they need a position:: import djcrud class Dashboard(djcrud.views.TemplateView): tags = djcrud.tags.NAVIGATION(position=0) class ReportList(djcrud.views.ListView): tags = djcrud.tags.Tag("reports", position=-1) A view that belongs to several menus can mix constants, positioned copies, and strings:: tags = [ djcrud.tags.NAVIGATION(position=0), djcrud.tags.TOPBAR, "reports", ] :meth:`~djcrud.router.Router.get_tagged_views` places ``position >= 0`` items at the start (``0``, then ``1``, …), unpositioned items next in declaration order, then negative positions (``-2``, then ``-1`` last). ``djcrud_auth`` uses this to keep **Log in** first and **Log out** last:: class LoginView(djcrud.views.FormView): tags = [ djcrud.tags.TOPBAR(position=0), djcrud.tags.NAVIGATION(position=0), ] class LogoutView(djcrud.views.FormView): tags = [ djcrud.tags.TOPBAR(position=-1), djcrud.tags.NAVIGATION(position=-1), ] .. automodule:: djcrud.tags :members: :exclude-members: as_tags, tag_position, position_sort_key :member-order: bysource