diff --git a/.gitignore b/.gitignore index 3afb01e..0d8962c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ *.pyc *~ -example/db.sqlite \ No newline at end of file +example/db.sqlite +django_admincommand.egg-info +.ropeproject +build/ +dist/ diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..0f46a76 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include README.rst + +recursive-include admincommand/templates * diff --git a/admincommand/admin.py b/admincommand/admin.py index 5d124a7..e9abf13 100644 --- a/admincommand/admin.py +++ b/admincommand/admin.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- +from functools import update_wrapper + from django.contrib import admin from django.shortcuts import render from django.contrib.admin.options import csrf_protect_m -from django.http import HttpResponse, HttpResponseRedirect -from django.shortcuts import redirect -from django.conf.urls.defaults import url +from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse -from django.http import HttpResponseBadRequest -from django.conf.urls.defaults import patterns +try: + from django.conf.urls import url, patterns +except ImportError: + from django.conf.urls.defaults import url, patterns from django.utils.encoding import force_unicode -from django.utils.functional import update_wrapper from django.http import HttpResponseForbidden from django.utils.safestring import mark_safe from django.contrib import messages @@ -25,9 +26,9 @@ class AdminCommandAdmin(SneakAdmin): list_display = ('command_name',) - def queryset(self, request): + def get_queryset(self, request): # user current user to construct the queryset - # so that only commands the user can execute + # so that only commands the user can execute # will be visible return CommandQuerySet(request.user) diff --git a/admincommand/migrations/0001_initial.py b/admincommand/migrations/0001_initial.py new file mode 100644 index 0000000..400c509 --- /dev/null +++ b/admincommand/migrations/0001_initial.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='AdminCommand', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ], + options={ + 'abstract': False, + }, + ), + ] diff --git a/admincommand/migrations/__init__.py b/admincommand/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/example/urls.py b/example/urls.py index faf7e29..a36b9ed 100644 --- a/example/urls.py +++ b/example/urls.py @@ -1,4 +1,7 @@ -from django.conf.urls.defaults import patterns, include, url +try: + from django.conf.urls import url, patterns, include +except ImportError: + from django.conf.urls.defaults import url, patterns, include # Uncomment the next two lines to enable the admin: from django.contrib import admin diff --git a/setup.py b/setup.py index 7b8c72b..8178b3f 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python import os -from distutils.core import setup +from setuptools import setup, find_packages def read(fname): @@ -15,8 +15,7 @@ def read(fname): author='Djaz Team', author_email='devweb@liberation.fr', url='https://github.com/liberation/django-admincommand', - packages=['admincommand'], - data_files=[('admincommand/templates/admincommand', [ - 'admincommand/templates/admincommand/output.html', - 'admincommand/templates/admincommand/run.html'])] + packages=find_packages(), + include_package_data=True, + zip_safe=False )