Skip to content

ModelInfoViewSet ​

Overview ​

This viewset is for providing metadata about models, including fields, actions, and permissions to front-end clients. This is a read-only viewset.

You should be able to list all models, and get information about a specific model.

Effectively, this is a custom model viewset for content types.

urls using this viewset should provide the app_label and model as kwargs, for example:

py
path('model-info/<str:app_label>/<str:model>/', ModelInfoViewSet.as_view(), name='model-info')

get_object ​

Returns the object the view is displaying.

You may want to override this if you need to provide non-standard queryset lookups. Eg if objects are referenced using multiple keyword arguments in the url conf.

Signature ​

get_object(self)

Parameters ​

NameTypeRequiredDefaultDescription
selfyes

Source ​

server/vueda/info/viewsets.py:78

get_queryset ​

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

Signature ​

get_queryset(self)

Parameters ​

NameTypeRequiredDefaultDescription
selfyes

Source ​

server/vueda/info/viewsets.py:75

initial ​

Runs anything that needs to occur prior to calling the method handler.

Signature ​

initial(self, request, args, kwargs)

Parameters ​

NameTypeRequiredDefaultDescription
selfyes
requestyes
argsno
kwargsno

Source ​

server/vueda/info/viewsets.py:64

basename ​

description ​

detail ​

name ​

object ​

queryset ​

serializer_class ​

suffix ​

Source ​

server/vueda/info/viewsets.py:44