Base View

Account views for smarter api.

class smarter.apps.account.api.v1.views.base.AccountListViewBase(*args, **kwargs)[source]

Bases: SmarterAdminListAPIView

Base class for account list views.

dispatch(request, *args, **kwargs)[source]

Extend DRF dispatch() to add authentication checks and logging.

Parameters:

request (HttpRequest) – The incoming HTTP request.

Returns:

The HTTP response generated by the view.

Return type:

HttpResponse

Raises:
  • AuthenticationFailed – Raised when authentication fails.

  • SmarterTokenAuthenticationError – Raised for errors specific to SmarterTokenAuthentication.

serializer_class

alias of AccountSerializer

setup(request, *args, **kwargs)[source]

Setup the view. This is called by Django before dispatch() and is used to set up the view for the request.

class smarter.apps.account.api.v1.views.base.AccountViewBase(*args, **kwargs)[source]

Bases: SmarterAdminAPIView

Base class for account views.

dispatch(request, *args, **kwargs)[source]

Extend DRF dispatch() to add authentication check.

Parameters:

request (HttpRequest) – The incoming HTTP request.

Raises:
  • AuthenticationFailed – Raised when authentication fails.

  • SmarterTokenAuthenticationError – Raised for errors specific to SmarterTokenAuthentication.

serializer_class

alias of AccountSerializer

smarter.apps.account.api.v1.views.base.should_log(level)[source]

Check if logging should be done based on the waffle switch.