Contents¶
Models¶
-
class
admin_kit.models.
BaseField
(kit_config=None, ajax_source=None, ajax_target=None, ajax_subscribe=False, *args, **kwargs)[source]¶ The Base model field of Admin-Kit models. This inherits Django’s models.Field class.
-
deconstruct
()[source]¶ Deconstructs the field to a tuple of 4 elements. This is used to recreate the same object.
-
formfield
(form_class, choices_form_class=None, **kwargs)[source]¶ Returns the form object to be used for rendering.
-
from_db_value
(value, expression, connection, context)[source]¶ Returns value from the database. inherited models should override this
-
Fields¶
Widgets¶
Site¶
-
class
admin_kit.sites.
AdminKitSite
(name='admin_kit')[source]¶ The main AdminKitSite that routes and process url requests.
-
register
(key, ajax_class)[source]¶ Registers the
ajax_class
for ajax behaviour- key :: str
- This is the key that will be used in models for binding
- ajax_class :: class
- The ajax class that inherits
admin_kit.ajax.Ajax
-
-
admin_kit.site.
register
(key, ajax_class)¶ Registers the
ajax_class
for ajax behaviour. This is same asadmin_kit.sites.AdminKitSite.register
method- key :: str
- This is the key that will be used in models for binding
- ajax_class :: class
- The ajax class that inherits
admin_kit.ajax.Ajax
Ajax¶
-
class
admin_kit.ajax.
Ajax
[source]¶ This is the base class for Ajax functionality.
- response_type : str
- The response type of the API. By default its set to
json
, It also acceptstext
. - unique : bool
- If True, the
key
is prepended with class name slug, Thus making it unique per class.
-
classmethod
generate_key
(key)[source]¶ A class method that generates key, that maps to the function
If
unique
attribute is true, then it appends hiphen seperated class name to actualkey
Example:
>>> import DummyAjaxClass >>> DummyAjaxClass.generateKey('the_key') the_key >>> DummyAjaxClass.unique = True >>> DummyAjaxClass.generateKey('the_key') dummy-ajax-class-the_key