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 details)

Uploaded Source

File details

Details for the file django-appregister-0.1.tar.gz.

File metadata

File hashes

Hashes for django-appregister-0.1.tar.gz
Algorithm Hash digest
SHA256 d1de0374133f2177c2d776b45af4508a80a07acffd1e164186086010aca7131d
MD5 aa44ee35e0482865f25f0ab98bf3deb6
BLAKE2b-256 3e96090e24035da6e2af3569443c3778ef9c297f626eb7b125872bf7bf3dcb34

See more details on using hashes here.

Supported by

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