Skip to content
This repository has been archived by the owner on Jun 20, 2018. It is now read-only.

Mega pull request - Django 1.8 support, tests, tidy up, future compatibility #24

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
end_of_line = lf

[*.py]
line_length=120
multi_line_output=5
known_third_party=django
known_first_party=nexus,testapp
48 changes: 44 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
*.pyc
*.egg-info/
.DS_Store
dist/
*.py[cod]

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.eggs
.installed.cfg
lib
lib64

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.coverage*
.tox
nosetests.xml
htmlcov

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# Complexity
output/*.html
output/*/index.html

# Sphinx
docs/_build
32 changes: 18 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ Nexus

Nexus is a pluggable admin application in Django. It's designed to give you a simple design and architecture for building admin applications.

(This project is still under active development)

Screenshot
==========

Expand All @@ -13,35 +11,41 @@ Screenshot
Install
=======

Install it with pip (or easy_install)::
Install it with pip (or easy_install):

.. code-block:: bash

pip install nexus

Config
======

You'll need to enable it much like you would ``django.contrib.admin``.

First, add it to your ``INSTALLED_APPS`` setting::
First, add it to your ``INSTALLED_APPS`` setting:

INSTALLED_APPS = (
...
'nexus',
)
.. code-block:: python

Now you'll want to include it within your ``urls.py``::
INSTALLED_APPS = (
...
'nexus',
)

Now you'll want to include it within your ``urls.py``:

.. code-block:: python

import nexus

# sets up the default nexus site by detecting all nexus_modules.py files
nexus.autodiscover()

# urls.py
urlpatterns = patterns('',
('^nexus/', include(nexus.site.urls)),
)

By default Nexus requires django.contrib.auth and django.contrib.sessions. If you are using a custom auth system you can skip these requirements by using the setting ``NEXUS_SKIP_INSTALLED_APPS_REQUIREMENTS = True`` in your django settings.
By default Nexus requires ``django.contrib.auth`` and ``django.contrib.sessions``. If you are using a custom auth system you can skip these requirements by using the setting ``NEXUS_SKIP_INSTALLED_APPS_REQUIREMENTS = True`` in your django settings.

Modules
=======
Expand All @@ -56,4 +60,4 @@ Other applications which provide Nexus modules:
* `django-debug-logging <https://github.com/lincolnloop/django-debug-logging>`_
* `Django-Experiments <https://github.com/mixcloud/django-experiments>`_

(docs on writing modules coming soon)
If you want to write a module, look at the ``example_module`` folder for a hello world implementation. Also the source code shouldn't be too hard to understand.
7 changes: 5 additions & 2 deletions example_module/nexus_modules.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import nexus


class HelloWorldModule(nexus.NexusModule):
home_url = 'index'
name = 'hello-world'
Expand All @@ -10,7 +11,8 @@ def get_title(self):
def get_urls(self):
from django.conf.urls.defaults import patterns, url

urlpatterns = patterns('',
urlpatterns = patterns(
'',
url(r'^$', self.as_view(self.index), name='index'),
)

Expand All @@ -25,6 +27,7 @@ def index(self, request):
return self.render_to_response("nexus/example/index.html", {
'title': 'Hello World',
}, request)

nexus.site.register(HelloWorldModule, 'hello-world')
# optionally you may specify a category
# nexus.site.register(HelloWorldModule, 'hello-world', category='cache')
# nexus.site.register(HelloWorldModule, 'hello-world', category='cache')
1 change: 0 additions & 1 deletion example_project/.gitignore

This file was deleted.

12 changes: 0 additions & 12 deletions example_project/manage.py

This file was deleted.

135 changes: 0 additions & 135 deletions example_project/settings.py

This file was deleted.

1 change: 0 additions & 1 deletion example_project/templates/404.html

This file was deleted.

1 change: 0 additions & 1 deletion example_project/templates/500.html

This file was deleted.

12 changes: 0 additions & 12 deletions example_project/urls.py

This file was deleted.

5 changes: 4 additions & 1 deletion nexus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@

__all__ = ('autodiscover', 'NexusSite', 'NexusModule', 'site')

default_app_config = 'nexus.apps.NexusAppConfig'

# A flag to tell us if autodiscover is running. autodiscover will set this to
# True while running, and False when it finishes.
LOADING = False


def autodiscover(site=None):
"""
Auto-discover INSTALLED_APPS nexus.py modules and fail silently when
Expand All @@ -43,8 +46,8 @@ def autodiscover(site=None):
globals()['site'] = locals()['site']

import imp
from django.utils.importlib import import_module
from django.conf import settings
from nexus.compat import import_module

for app in settings.INSTALLED_APPS:
# For each app, we need to look for an api.py inside that app's
Expand Down
10 changes: 10 additions & 0 deletions nexus/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.apps import AppConfig


class NexusAppConfig(AppConfig):
name = 'nexus'
verbose_name = "Nexus"

def ready(self):
from nexus.checks import register_checks
register_checks()
Loading