Documentation
¶
Overview ¶
templ: version: v0.3.1020
Index ¶
- Constants
- func Register(chsr chooser, key ...string)
- type BoundChooserFormPage
- func (v *BoundChooserFormPage[T]) Render(w http.ResponseWriter, req *http.Request, context ctx.Context) error
- func (v *BoundChooserFormPage[T]) ServeXXX(w http.ResponseWriter, req *http.Request)
- func (v *BoundChooserFormPage[T]) Setup(w http.ResponseWriter, req *http.Request) (http.ResponseWriter, *http.Request)
- type BoundChooserListPage
- func (v *BoundChooserListPage[T]) GetContext(req *http.Request) (ctx.Context, error)
- func (v *BoundChooserListPage[T]) Render(w http.ResponseWriter, req *http.Request, context ctx.Context) error
- func (v *BoundChooserListPage[T]) ServeXXX(w http.ResponseWriter, req *http.Request)
- func (v *BoundChooserListPage[T]) Setup(w http.ResponseWriter, req *http.Request) (http.ResponseWriter, *http.Request)
- type ChooserDefinition
- func (c *ChooserDefinition[T]) CanCreate() bool
- func (c *ChooserDefinition[T]) CreateView(adminSite *admin.AdminApplication, app *admin.AppDefinition, ...) views.View
- func (c *ChooserDefinition[T]) GetContext(req *http.Request, page, bound views.View) *ModalContext
- func (c *ChooserDefinition[T]) GetExtraData(ctx context.Context, instance attrs.Definer) map[string]any
- func (o *ChooserDefinition[T]) GetLabel(labels map[string]func(context.Context) string, field string, default_ any) func(ctx context.Context) string
- func (c *ChooserDefinition[T]) GetModel() attrs.Definer
- func (c *ChooserDefinition[T]) GetPreviewString(ctx context.Context, instance attrs.Definer) (previewString string)
- func (c *ChooserDefinition[T]) GetTitle(ctx context.Context) string
- func (c *ChooserDefinition[T]) ListView(adminSite *admin.AdminApplication, app *admin.AppDefinition, ...) views.View
- func (c *ChooserDefinition[T]) Media() media.Media
- func (c *ChooserDefinition[T]) Render(w http.ResponseWriter, req *http.Request, context ctx.Context, ...) error
- func (c *ChooserDefinition[T]) Setup(chooserKey string) error
- type ChooserFormPage
- func (v *ChooserFormPage[T]) Bind(w http.ResponseWriter, req *http.Request) (views.View, error)
- func (v *ChooserFormPage[T]) GetContext(req *http.Request, bound *BoundChooserFormPage[T]) *ModalContext
- func (v *ChooserFormPage[T]) GetTemplate(req *http.Request) string
- func (v *ChooserFormPage[T]) Methods() []string
- func (v *ChooserFormPage[T]) ServeXXX(w http.ResponseWriter, req *http.Request)
- type ChooserListPage
- func (v *ChooserListPage[T]) Bind(w http.ResponseWriter, req *http.Request) (views.View, error)
- func (v *ChooserListPage[T]) ColumnFormat(field string) any
- func (v *ChooserListPage[T]) FilterQuerySet(qs *queries.QuerySet[T], req *http.Request) *queries.QuerySet[T]
- func (v *ChooserListPage[T]) GetContext(req *http.Request, bound *BoundChooserListPage[T]) *ModalContext
- func (v *ChooserListPage[T]) GetList(req *http.Request, amount, page int) (any, pagination.PageObject[T], error)
- func (v *ChooserListPage[T]) GetListColumns(req *http.Request) []list.ListColumn[T]
- func (v *ChooserListPage[T]) GetQuerySet(req *http.Request) (*queries.QuerySet[T], error)
- func (v *ChooserListPage[T]) GetTemplate(r *http.Request) string
- func (v *ChooserListPage[T]) Methods() []string
- func (v *ChooserListPage[T]) SearchVar() string
- func (v *ChooserListPage[T]) ServeXXX(w http.ResponseWriter, req *http.Request)
- type ChooserResponse
- type ChooserWidget
- func (b *ChooserWidget) GetContextData(c context.Context, id, name string, value interface{}, ...) ctx.Context
- func (w *ChooserWidget) Media() media.Media
- func (b *ChooserWidget) Render(ctx context.Context, w io.Writer, id, name string, value interface{}, ...) error
- func (b *ChooserWidget) RenderWithErrors(ctx context.Context, w io.Writer, id, name string, value interface{}, ...) error
- func (w *ChooserWidget) Validate(ctx context.Context, value interface{}) []error
- func (w *ChooserWidget) ValueToForm(value interface{}) interface{}
- func (w *ChooserWidget) ValueToGo(value interface{}) (interface{}, error)
- type ModalContext
- type Renderable
- type WrappedModel
Constants ¶
View Source
const (
DEFAULT_KEY = "default"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BoundChooserFormPage ¶
type BoundChooserFormPage[T attrs.Definer] struct { *views.FormView[*admin.AdminForm[modelforms.ModelForm[attrs.Definer], attrs.Definer]] View *ChooserFormPage[T] ResponseWriter http.ResponseWriter Request *http.Request Model T // contains filtered or unexported fields }
func (*BoundChooserFormPage[T]) Render ¶
func (v *BoundChooserFormPage[T]) Render(w http.ResponseWriter, req *http.Request, context ctx.Context) error
func (*BoundChooserFormPage[T]) ServeXXX ¶
func (v *BoundChooserFormPage[T]) ServeXXX(w http.ResponseWriter, req *http.Request)
func (*BoundChooserFormPage[T]) Setup ¶
func (v *BoundChooserFormPage[T]) Setup(w http.ResponseWriter, req *http.Request) (http.ResponseWriter, *http.Request)
type BoundChooserListPage ¶
type BoundChooserListPage[T attrs.Definer] struct { View *ChooserListPage[T] ResponseWriter http.ResponseWriter Request *http.Request Model T }
func (*BoundChooserListPage[T]) GetContext ¶
func (*BoundChooserListPage[T]) Render ¶
func (v *BoundChooserListPage[T]) Render(w http.ResponseWriter, req *http.Request, context ctx.Context) error
func (*BoundChooserListPage[T]) ServeXXX ¶
func (v *BoundChooserListPage[T]) ServeXXX(w http.ResponseWriter, req *http.Request)
func (*BoundChooserListPage[T]) Setup ¶
func (v *BoundChooserListPage[T]) Setup(w http.ResponseWriter, req *http.Request) (http.ResponseWriter, *http.Request)
type ChooserDefinition ¶
type ChooserDefinition[T attrs.Definer] struct { ChooserKey string Model T Title any // string or func(ctx context.Context) string Labels map[string]func(ctx context.Context) string PreviewString func(ctx context.Context, instance T) string ExtraData func(ctx context.Context, instance T) map[string]any ListPage *ChooserListPage[T] CreatePage *ChooserFormPage[T] DjangoApp django.AppConfig AdminApp *admin.AppDefinition AdminModel *admin.ModelDefinition MediaFn func() media.Media }
func (*ChooserDefinition[T]) CanCreate ¶
func (c *ChooserDefinition[T]) CanCreate() bool
func (*ChooserDefinition[T]) CreateView ¶
func (c *ChooserDefinition[T]) CreateView(adminSite *admin.AdminApplication, app *admin.AppDefinition, model *admin.ModelDefinition) views.View
func (*ChooserDefinition[T]) GetContext ¶
func (c *ChooserDefinition[T]) GetContext(req *http.Request, page, bound views.View) *ModalContext
func (*ChooserDefinition[T]) GetExtraData ¶
func (*ChooserDefinition[T]) GetModel ¶
func (c *ChooserDefinition[T]) GetModel() attrs.Definer
func (*ChooserDefinition[T]) GetPreviewString ¶
func (*ChooserDefinition[T]) GetTitle ¶
func (c *ChooserDefinition[T]) GetTitle(ctx context.Context) string
func (*ChooserDefinition[T]) ListView ¶
func (c *ChooserDefinition[T]) ListView(adminSite *admin.AdminApplication, app *admin.AppDefinition, model *admin.ModelDefinition) views.View
func (*ChooserDefinition[T]) Media ¶
func (c *ChooserDefinition[T]) Media() media.Media
func (*ChooserDefinition[T]) Render ¶
func (c *ChooserDefinition[T]) Render(w http.ResponseWriter, req *http.Request, context ctx.Context, base, template string) error
func (*ChooserDefinition[T]) Setup ¶
func (c *ChooserDefinition[T]) Setup(chooserKey string) error
type ChooserFormPage ¶
type ChooserFormPage[T attrs.Definer] struct { Template string AllowedMethods []string Options admin.FormViewOptions // contains filtered or unexported fields }
func (*ChooserFormPage[T]) Bind ¶
func (v *ChooserFormPage[T]) Bind(w http.ResponseWriter, req *http.Request) (views.View, error)
func (*ChooserFormPage[T]) GetContext ¶
func (v *ChooserFormPage[T]) GetContext(req *http.Request, bound *BoundChooserFormPage[T]) *ModalContext
func (*ChooserFormPage[T]) GetTemplate ¶
func (v *ChooserFormPage[T]) GetTemplate(req *http.Request) string
func (*ChooserFormPage[T]) Methods ¶
func (v *ChooserFormPage[T]) Methods() []string
func (*ChooserFormPage[T]) ServeXXX ¶
func (v *ChooserFormPage[T]) ServeXXX(w http.ResponseWriter, req *http.Request)
type ChooserListPage ¶
type ChooserListPage[T attrs.Definer] struct { Template string SearchQueryVar string AllowedMethods []string // Fields to include for the model in the view Fields []string // Labels for the fields in the view // // This is a map of field name to a function that returns the label for the field. // // Allowing for custom labels for fields in the view. Labels map[string]func(ctx context.Context) string // PerPage is the number of items to show per page. // // This is used for pagination in the list view. PerPage uint64 // Columns are used to define the columns in the list view. // // This allows for custom rendering logic of the columns in the list view. Columns map[string]list.ListColumn[T] // Format is a map of field name to a function that formats the field value. // // I.E. map[string]func(v any) any{"Name": func(v any) any { return strings.ToUpper(v.(string)) }} // would uppercase the value of the "Name" field in the list view. Format map[string]func(v any) any // QuerySet is a function that returns a queries.QuerySet to use for the list view. QuerySet func(r *http.Request, model T) (*queries.QuerySet[T], error) // Filter is a function that applies filters to the QuerySet. Filter func(qs *queries.QuerySet[T], req *http.Request, searchValue string) *queries.QuerySet[T] // SearchFields are the fields to search in the list view. SearchFields []admin.SearchField // NewList returns a new list object to render in the list view. NewList func(req *http.Request, results []T, def *ChooserDefinition[T]) any // BoundView returns a new bound view for the list page. BoundView func(w http.ResponseWriter, req *http.Request, v *ChooserListPage[T], d *ChooserDefinition[T]) (views.View, error) // contains filtered or unexported fields }
func (*ChooserListPage[T]) Bind ¶
func (v *ChooserListPage[T]) Bind(w http.ResponseWriter, req *http.Request) (views.View, error)
func (*ChooserListPage[T]) ColumnFormat ¶
func (v *ChooserListPage[T]) ColumnFormat(field string) any
func (*ChooserListPage[T]) FilterQuerySet ¶
func (*ChooserListPage[T]) GetContext ¶
func (v *ChooserListPage[T]) GetContext(req *http.Request, bound *BoundChooserListPage[T]) *ModalContext
func (*ChooserListPage[T]) GetList ¶
func (v *ChooserListPage[T]) GetList(req *http.Request, amount, page int) (any, pagination.PageObject[T], error)
func (*ChooserListPage[T]) GetListColumns ¶
func (v *ChooserListPage[T]) GetListColumns(req *http.Request) []list.ListColumn[T]
func (*ChooserListPage[T]) GetQuerySet ¶
func (*ChooserListPage[T]) GetTemplate ¶
func (v *ChooserListPage[T]) GetTemplate(r *http.Request) string
func (*ChooserListPage[T]) Methods ¶
func (v *ChooserListPage[T]) Methods() []string
func (*ChooserListPage[T]) SearchVar ¶
func (v *ChooserListPage[T]) SearchVar() string
func (*ChooserListPage[T]) ServeXXX ¶
func (v *ChooserListPage[T]) ServeXXX(w http.ResponseWriter, req *http.Request)
type ChooserResponse ¶
type ChooserWidget ¶
type ChooserWidget struct {
*widgets.BaseWidget
TemplateKey string
Templates []string
Definition chooser
Model attrs.Definer
App django.AppConfig
ContentType *contenttypes.BaseContentType[attrs.Definer]
ChooserKey string
}
func NewChooserWidget ¶
func (*ChooserWidget) GetContextData ¶
func (*ChooserWidget) Media ¶
func (w *ChooserWidget) Media() media.Media
func (*ChooserWidget) RenderWithErrors ¶
func (*ChooserWidget) Validate ¶
func (w *ChooserWidget) Validate(ctx context.Context, value interface{}) []error
func (*ChooserWidget) ValueToForm ¶
func (w *ChooserWidget) ValueToForm(value interface{}) interface{}
func (*ChooserWidget) ValueToGo ¶
func (w *ChooserWidget) ValueToGo(value interface{}) (interface{}, error)
type ModalContext ¶
type ModalContext struct {
ctx.ContextWithRequest
Definition chooser
Title any
Errors []error
View views.View
}
func (*ModalContext) GetTitle ¶
func (c *ModalContext) GetTitle() string
type Renderable ¶
type Renderable interface {
Render() string
}
type WrappedModel ¶
type WrappedModel[T attrs.Definer] struct { Model T Definition *ChooserDefinition[T] Context context.Context }
func WrapModel ¶
func WrapModel[T attrs.Definer](ctx context.Context, def *ChooserDefinition[T], model T) *WrappedModel[T]
func WrapModels ¶
func WrapModels[T attrs.Definer](ctx context.Context, def *ChooserDefinition[T], models []T) []*WrappedModel[T]
func (*WrappedModel[T]) ExtraData ¶
func (w *WrappedModel[T]) ExtraData() map[string]any
func (*WrappedModel[T]) PreviewHTML ¶
func (w *WrappedModel[T]) PreviewHTML() string
Click to show internal directories.
Click to hide internal directories.