Skip to main content

A Django app that provides the building blocks for an app registry system

Project description

Django Appregister is a class registry system to allow you to easily implement a puggable

See http://appregister.readthedocs.org/ for further documentation.

Usage Example

In myapp/registry.py:

from appregister import Register

class QuestionRegister(Register):
    base = 'myapp.models.Question'
    discovermodule = 'questions'

questions = QuestionRegister()

if myapp/models.py:

from django.db import models
from myapp import registry

class Question(models.Model):
    pass

@registry.questions.register
class MultipleChoiceQuestion(Question):
    pass

You can then access all classes that have been registered by your app or by another app that extends it:

from myapp import registry

classes = registry.questions.all()

If you add the following lines to your urls.py, you can autodiscover all question sublclasses that have been added to any of the apps in your INSTALLED_APPS:

from myapp import registry

registry.questions.autodiscover()

This then allows developers to add their own subclasses to questions.py within their apps and have them registered to the system for use, in a similar way to the addition and registration of ModelAdmins in admin.py files for Django’s admin.

Project details


Download files

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

Source Distribution

django-appregister-0.1.tar.gz (4.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page