Skip to content

Latest commit

 

History

History
139 lines (103 loc) · 3.95 KB

routes.rst

File metadata and controls

139 lines (103 loc) · 3.95 KB

Routes and route mixins

django_crucrudile.routes

A route is an implementation of the django_crucrudile.entities.Entity abstract class that yields URL patterns made from its attributes. In the code, this is represented by subclassing django_crucrudile.entities.Entity and providing a generator in patterns(), yielding URL patterns made from the route attributes. When route classes provide django_crucrudile.entities.Entity.patterns, it makes them become concrete implementations of the Entity abstract class. Route classes themselves are abstract by nature and need a definition of the abstract function base.BaseRoute.get_callback.

  • CallbackRoute : Implements base.BaseRoute using mixins.callback.CallbackMixin that provides an implementation of base.BaseRoute.get_callback that returns the callback set on the route (either in CallbackRoute.__init__ or as class attribute)
  • ViewRoute : Implements base.BaseRoute using mixins.view.ViewMixin that provides an implementation of base.BaseRoute.get_callback that returns the a callback obtaining from the view class set on the route (either in mixins.view.ViewMixin.__init__ or as class attribute).
  • ModelViewRoute : Implements base.BaseRoute using mixins.view.ViewMixin and mixins.model.ModelMixin, passes the model in the view keyword arguments, and can be used with Django generic views.

Base route

django_crucrudile.routes.base

Route mixins

django_crucrudile.routes.mixins

Abstract

Arguments

django_crucrudile.routes.mixins.arguments

django_crucrudile.routes.mixins.arguments.ArgumentsMixin

Parser

django_crucrudile.routes.mixins.arguments.parser

Model

django_crucrudile.routes.mixins.model

Concrete

Callback

django_crucrudile.routes.mixins.callback

View

django_crucrudile.routes.mixins.view

django_crucrudile.routes

Callback route

django_crucrudile.routes.CallbackRoute

View route

django_crucrudile.routes.ViewRoute

Model view route

django_crucrudile.routes.ModelViewRoute