# Path: sequere/registry.py
# class SequereRegistry(dict):
#     def __init__(self):
#     def for_model(self, model):
#     def get_identifier(self, instance):
#     def identifiers(self):
#     def unregister(self, name):
#     def register(self, *args, **kwargs):
#     def _register_model(self, model, sequere=None,
#                         name=None, **kwargs):
#     def _register(self, sequere):
# def autodiscover():
# def register(*args, **kwargs):
# 
# Path: sequere/models.py
# def get_followers_count(instance, *args, **kwargs):
#     from sequere import app
# 
#     return app.backend.get_followers_count(instance, *args, **kwargs)
# 
# def follow(from_instance, to_instance):
#     from sequere import app
# 
#     return app.backend.follow(from_instance, to_instance)
# 
# def unfollow(from_instance, to_instance):
#     from sequere import app
# 
#     return app.backend.unfollow(from_instance, to_instance)
# 
# def get_followings_count(instance, *args, **kwargs):
#     from sequere import app
# 
#     return app.backend.get_followings_count(instance, *args, **kwargs)


from django.views import generic
from django.utils.decorators import method_decorator
from django.http import HttpResponseBadRequest, JsonResponse
from django.shortcuts import redirect, get_object_or_404
from django.contrib.auth.decorators import login_required
from sequere.registry import registry
from sequere.models import (get_followers_count,
                            follow,
                            unfollow,
                            get_followings_count)
            return HttpResponseBadRequest()

        model = registry.identifiers.get(self.identifier, None)

        try:
            object_id = int(object_id)
        except ValueError:
            return HttpResponseBadRequest()

        if not model:
            return HttpResponseBadRequest()

        self.instance = get_object_or_404(model, pk=object_id)

        if self.instance == self.request.user:
            return HttpResponseBadRequest()

        return self.redirect(self.success(self.instance))

    def redirect(self, instance):
        if not self.request.is_ajax():
            redirect_url = self.data.get(self.redirect_url_name, self.success_url)

            if redirect_url:
                return redirect(redirect_url)

        data = {
            'followers_count': get_followers_count(self.instance),
            'followings_count': get_followings_count(self.request.user),
            '%s_followers_count' % self.identifier: get_followers_count(self.instance, self.identifier),

# Path: sequere/registry.py
# class SequereRegistry(dict):
#     def __init__(self):
#     def for_model(self, model):
#     def get_identifier(self, instance):
#     def identifiers(self):
#     def unregister(self, name):
#     def register(self, *args, **kwargs):
#     def _register_model(self, model, sequere=None,
#                         name=None, **kwargs):
#     def _register(self, sequere):
# def autodiscover():
# def register(*args, **kwargs):
# 
# Path: sequere/models.py
# def get_followers_count(instance, *args, **kwargs):
#     from sequere import app
# 
#     return app.backend.get_followers_count(instance, *args, **kwargs)
# 
# def follow(from_instance, to_instance):
#     from sequere import app
# 
#     return app.backend.follow(from_instance, to_instance)
# 
# def unfollow(from_instance, to_instance):
#     from sequere import app
# 
#     return app.backend.unfollow(from_instance, to_instance)
# 
# def get_followings_count(instance, *args, **kwargs):
#     from sequere import app
# 
#     return app.backend.get_followings_count(instance, *args, **kwargs)


# Path: sequere/contrib/user/views.py
from django.views import generic
from django.utils.decorators import method_decorator
from django.http import HttpResponseBadRequest, JsonResponse
from django.shortcuts import redirect, get_object_or_404
from django.contrib.auth.decorators import login_required
from sequere.registry import registry
from sequere.models import (get_followers_count,
                            follow,
                            unfollow,
                            get_followings_count)

            return HttpResponseBadRequest()

        model = registry.identifiers.get(self.identifier, None)

        try:
            object_id = int(object_id)
        except ValueError:
            return HttpResponseBadRequest()

        if not model:
            return HttpResponseBadRequest()

        self.instance = get_object_or_404(model, pk=object_id)

        if self.instance == self.request.user:
            return HttpResponseBadRequest()

        return self.redirect(self.success(self.instance))

    def redirect(self, instance):
        if not self.request.is_ajax():
            redirect_url = self.data.get(self.redirect_url_name, self.success_url)

            if redirect_url:
                return redirect(redirect_url)

        data = {
            'followers_count': get_followers_count(self.instance),
            'followings_count': get_followings_count(self.request.user),
            '%s_followers_count' % self.identifier: get_followers_count(self.instance, self.identifier),

            '%s_followings_count' % self.identifier: get_followings_count(self.request.user, self.identifier),