CRApp

INDEXVIEW_NAME = 'INDEX'

The name of the app index view (the landing page for the app). We do not enforce this, but we assume that each app has a view with this name.

class Url(regex, view, kwargs=None, name=None)

Bases: object

Url is mostly the same as func:django.conf.urls.url. You use Url to add urls to an app.

Parameters:
  • regex – The URL regex.
  • view – The view (E.g.: MyView.as_view()).
  • kwargs – Keyword arguments for the view.
  • name – The name of the view. This just have to be unique within the App - the actual URL name is generated based on the app name and the django_cradmin.crinstance.BaseCrAdminInstance.id.
class App(appname, request, active_viewname)

Bases: object

A cradmin App.

Added to a django_cradmin.crinstance.BaseCrAdminInstance with django_cradmin.crinstance.BaseCrAdminInstance.apps.

appurls = []

See get_appurls().

reverse_appurl(viewname, args=None, kwargs=None)

Works just like django.core.urlresolvers.reverse(), except that the name is the name given in appurls, not the full name of the URL.

This means that you should use this to reverse urls within this app.

reverse_appindexurl(args=None, kwargs=None)

Shortcut for:

reverse_appurl(crapp.INDEXVIEW_NAME, args=args, kwargs=kwargs)
classmethod get_appurls()

Get app URLs. Defaults to appurls.

Returns:class:.Url objects.
Return type:A list of
classmethod build_urls(cradmin_instance_id, appname)

Used internally by django_cradmin.crinstance.BaseCrAdminInstance.urls() to build urls for all views in the app.