Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

All Basic is a simple Django app to to add some basic functionality to use the DRF API.

Project description

All Basic

All Basic is a simple Django app to to add some basic functionality to use the DRF API. It consists of separating business logic and the application of nested data that comes from user requests and validations that support nested data.

Quick start

Add allbasic to your INSTALLED_APPS setting like this:


Create an application (what name is up) and create several files:


In your

from allbasic.validations import BaseValidation

class ValidationUserDetailUpdate(BaseValidation):
    def schema(self):
        return {
            'last_name': {
                'type': 'string',
                'required': True,
                'empty': False
            'first_name': {
                'type': 'string',
                'required': True,
                'empty': False

In your

from import BaseDomain

class DomainUserUpdate(BaseDomain):
    def apply(self):
        data = self.context.get('data')
        user = self.context.get('user')

        user.first_name = data.get('first_name', user.first_name)
        user.last_name = data.get('last_name', user.last_name)


In your

from allbasic.presentations import BasePresentation

class UserDetailPresentation(BasePresentation):
    def present(self):
        user = self.context.get('user')

        return {
            'username': user.username,
            'last_name': user.last_name,
            'first_name': user.first_name

In your

from import ContextDomain
from allbasic.presentations import ContextPresentation
from allbasic.validations import ContextValidation

class UserDetailView(APIView):
    authentication_classes = (
    permission_classes = (IsAuthenticated,)

    def put(self, request):
        validation = ContextValidation(ValidationUserDetailUpdate(

        if validation.validate():
            ContextDomain(DomainUserUpdate(context={'data':, 'user': request.user})).do_apply()
            presentation = ContextPresentation(UserDetailPresentation(context={'user': request.user}))
            return Response(presentation.do_present())

        return Response(validation.errors, status=status.HTTP_400_BAD_REQUEST)

Project details

Release history Release notifications

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-allbasic, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size django-allbasic-0.1.tar.gz (4.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page