noc.lib.app.extmodelapplication

Module Contents

class noc.lib.app.extmodelapplication.ExtModelApplication(*args, **kwargs)

Bases: noc.lib.app.extapplication.ExtApplication

model
icon = icon_application_view_list
query_fields = []
query_condition = startswith
int_query_fields = []
pk_field_name
clean_fields
custom_fields
custom_m2m_fields
secret_fields
order_map
lookup_default
ignored_fields
SECRET_MASK = ********
file_fields_mask
get_permissions(self)
get_validator(self, field)

Returns Parameter instance or None to clean up field :param field: :type field: Field :return:

fav_convert(self, item)

Convert favorite item from string to storage format

get_custom_fields(self)
get_launch_info(self, request)
get_Q(self, request, query)

Prepare Q statement for query

queryset(self, request, query=None)

Filter records for lookup

clean(self, data)

Clean up input data :param data: dict of parameters :type data: dict :return: dict of cleaned parameters of raised InterfaceTypeError :rtype: dict

cleaned_query(self, q)
has_secret(self)

Check current user has secret permission on given app :return:

instance_to_dict(self, o, fields=None)
instance_to_lookup(self, o, fields=None)
lookup_tags(self, q, name, value)
update_m2m(self, o, name, values)
update_m2ms(self, o, attrs)

Update all m2m fields

split_mtm(self, pdata)

Split post data to (fields, m2mfields) data

update_file(self, files, o, file_attrs=None)

Proccessed uploaded file :param files: :param o: :param file_attrs: :return:

split_file(self, pdata)

Split post data to (fields, file_fields) data

extra_query(self, q, order)
can_create(self, user, obj)

Check user can create object. Used to additional restrictions after permissions check :param user: :param obj: Object instance :return: True if access granted

can_update(self, user, obj)

Check user can update object. Used to additional restrictions after permissions check :param user: :param obj: Object instance :return: True if access granted

can_delete(self, user, obj)

Check user can delete object. Used to additional restrictions after permissions check :param user: :param obj: Object instance :return: True if access granted

api_list(self, request)
api_lookup(self, request)
api_create(self, request)
api_read(self, request, id)

Returns dict with object’s fields and values

api_update(self, request, id)
api_delete(self, request, id)
api_action_group_edit(self, request)