Git Product home page Git Product logo

django-adminplus's People

Contributors

bashu avatar drdaeman avatar ivorbosloper avatar j4mie avatar jsocol avatar laginha avatar lvella avatar mdgart avatar mikhuang avatar nautilebleu avatar outime avatar pykler avatar sobolevn avatar stretch4x4 avatar yprez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-adminplus's Issues

AdminPlus does not autodiscover 'sites' framework

Hi,

Congrats on AdminPlus! It's a great and very useful package.

I followed the Installing & Using instructions and have been able to add a custom view. However, when using AdminPlus, I noticed that some built-in models disappeared from the admin site; namely, the "sites" framework (... models related to the django-registration package also disappeared).

I was able to get the Sites admin back by doing

from django.contrib.sites.models import Site

admin.site = AdminSitePlus()
admin.site.register(Site)

It might be interesting to see if AdminPlus' autodiscovery could find out about the Sites framework, or note this in the documentation.

Cheers

adminplus compatibility with Mezzanine 3.1.10

I've tried integrating adminplus using the example provided with Mezzanine, but I keep getting a Page Not Found.

Does adminplus work with Mezzanine 3.1.10?

I added your example code to my project's 'theme/admin.py':

def my_view(request, *args, **kwargs):
    pass
admin.site.register_view('reporting', view=my_view)

Note: adminplus has been added to INSTALLED_APPS and admin.site has been set to AdminSitePlus as instructed.

Now have to set admin.sites.site

In order for default @admin.register to work, you have to also set admin.sites.site like so:

admin.site = admin.sites.site = AdminSitePlus()

Admin displays permission error.

I followed the readme and managed to get stuck. When I got to the admin index page, I am told I do not have permission to edit anything(see attached). I get no errors on the console. I have tried to delete the database and run syncdb again with the same result. If i comment out "admin.site = AdminSitePlus()", everything returns to normal(as expected). I am guessing something involving permissions changed between 1.4.2 and 1.4.3. Any suggestions how to resolve?
screenshot

I have...
Django 1.4.3
Python 2.7.3

Authentication and Authorization disappears in Django 1.9.6

Hi,

I resently upgraded from django 1.8.11 to 1.9.6. But now my "Authentication and Authorization" module in admin has disappeard. uncommenting the "admin.site = AdminSitePlus()" in my url lets it reappear again. Also downgrading to django 1.8.11 makes it appear again.
So I guess it is due to this app in combination with django 1.9.6. No idea what happens, though.

Maintain a changelog?

Hi! We really enjoy django-adminplus features, but it would be great to have a summarized changelog between versions to more easily figure out what has changed.

For now I'll look at the changelog, but it's not completely obvious:

v0.3...v0.4

Hide parameterized URLs

If a URL contains parameters, don't auto-show it.

I would think just looking for '(' in the URL would be enough.

Moving to adminplus locks out superuser from editing

When I add SimpleAdminConfig in settings.py, and set admin.site to a new AdminSitePlus in urls.py, I get the message "You don’t have permission to view or edit anything." when logged in as a superuser.

If I revert those two edits, switching back to the standard admin, I can see and edit as usual.

Happy to help debug but not sure where to start.

Incorrect pip install command

When I tried to install your package with pip command from README, pip (v. 0.7.2) showed following error:
pip install -e git://github.com/jsocol/django-adminplus
--editable=git://github.com/jsocol/django-adminplus is not the right format; it must have #egg=Package

I had to replace the command to pip install -e git://github.com/jsocol/django-adminplus#egg=django-adminplus to make it work. Please update the README. Thanks. :-)

Passing arguments?

Hello,

Is there a way to pass arguments to custom admin views? I'm trying to make an "edit object" page that can access the object of a different tenant in a multi-tenant environment (using django-tenant-schemas). To do this I need to pass the item id and tenant to my edit page but I haven't been successful at this so far. Do I need to override the admin urls myself perhaps?

Thanks,
William

Can't hit url pattern of custom view

I'm using the latest django 1.8 My urls.py looks this:

from django.contrib import admin
from adminplus.sites import AdminSitePlus
from django.conf.urls import include, url

admin.site = AdminSitePlus()
admin.autodiscover()

urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^chaining/', include('smart_selects.urls')),
]

My view looks like this:

def my_view(request, _args, *_kwargs):
pass
admin.site.register_view('somepath', view=my_view)

When i go to

mysite.com/admin/somepath I get a 404. Do you know what I'm doing wrong?

Missing core models from admin after adding adminplus

Hi,

Just spent today integrating adminplus into our Django 1.8.7 site, found an issue where 3 of our admin screens went missing after the upgrade.Turns out they are all core models (Groups, Users and Sites) and these are all added by an autodiscover that django runs before it loads the urls file.
See traceback for when the first one is added:
traceback
Saw this in a previous issue and it has solved the issue for now although I am hoping someone smarter than I can help us solve it better:

import copy
from django.contrib import admin
from django.conf.urls import patterns, include, url

from adminplus.sites import AdminSitePlus

old = admin.site
admin.site = AdminSitePlus()
admin.site._registry = copy.copy(old._registry)

Error finding 'django.contrib.admin.apps.SimpleAdminConfig'

I've followed the first couple of instructions from the README, but get an error:

/usr/bin/python2.7 /home/chris/mrg/mrgdbui/manage.py runserver 8000
Traceback (most recent call last):
  File "/home/chris/mrg/mrgdbui/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 280, in execute
    translation.activate('en-us')
  File "/usr/lib/python2.7/dist-packages/django/utils/translation/__init__.py", line 130, in activate
    return _trans.activate(language)
  File "/usr/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 188, in activate
    _active.value = translation(language)
  File "/usr/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 177, in translation
    default_translation = _fetch(settings.LANGUAGE_CODE)
  File "/usr/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 159, in _fetch
    app = import_module(appname)
  File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
ImportError: No module named apps.SimpleAdminConfig

Process finished with exit code 1

I have installed django-adminplus with:

$ sudo pip install django-adminplus
Downloading/unpacking django-adminplus
  Downloading django_adminplus-0.5-py2.py3-none-any.whl
Installing collected packages: django-adminplus
Successfully installed django-adminplus
Cleaning up...

and added it to the INSTALLED_APPS:

Application definition

INSTALLED_APPS = (
    'django.contrib.admin.apps.SimpleAdminConfig',
    #'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'mrg',
    'adminplus',
)

What have I missed?

django-adminplus 0.2 compatibility with Django 1.4.5

I have -e git://github.com/jsocol/django-adminplus#egg=django-adminplus in requirements.txt
I installed Django and django-adminplus in virtualenv and lost list of Custom Views in /admin/
Nevertheless I could view them directly:

admin.site.register_view('django-ses', dashboard, _('Django SES Stats'))

and URL /admin/django-ses/ works fine.
After that I installed version 0.1.7 and configured urls.py (adminplus instead of adminplus.sites in imports):

pip install -e git://github.com/jsocol/django-adminplus.git@09fa38724e8e05afc78f912da0ed78ef892da910#egg=django-adminplus

And got Custom Views list back.
Is it a bug?

All registered views are wrapped in admin.site.admin_view.

In the README.md it says: "All registered views are wrapped in admin.site.admin_view".

What does this mean?

Am I wrong in assuming that this should wrap my_view in an admin_view such that when I render it with a template which {% extends "admin/base_site.html" %} it should fill in the "Welcome, chris. View site / Change password / Log out" parts of the parent template?

It doesn't populate those parts, I just get an empty top-right header corner.

Have I misunderstood what "wrapped in admin.site.admin_view" means, or have I just written buggy code?

def my_view(request):
    return render(request, "admin/my_template.html")

admin.site.register_view('my_url', view=my_view)

If adminplus does not provide the user object for base.html to populate:

                {% if user.is_active and user.is_staff %}
                    {% url 'django-admindocs-docroot' as docsroot %}
                    {% if docsroot %}
                        <a href="{{ docsroot }}">{% trans 'Documentation' %}</a> /
                    {% endif %}
                {% endif %}
                {% if user.has_usable_password %}

then what is the cleanest way for me to do this?

Pass view objects to template

From my comment:

Groups, I'm actively against supporting here. But there's something I think we could do to help make groups work, that's more of a general solution: adding the view object itself to custom_list, so each entry would look like (path, name, view).

This would let people pass data into the template by attaching it to the view, like:

def my_admin_view(request):
    return render(request, 'my_admin_template.html')
my_admin_view.group = 'group 1'
admin.site.register_view('my-admin-view', view=my_admin_view)

Then they can override the template to group however/wherever they want.

Django 4 support

Django 4 breaks with Exception:

File "adminplus/sites.py", line 47, in get_urls
   from django.conf.urls import url
ImportError: cannot import name 'url' from 'django.conf.urls' (django/conf/urls/__init__.py)

The cause is; django.conf.urls.url() was deprecated since Django 3.1, is removed in Django 4.0+. It can be resolved by using path or re_path , see docs.

Models not resolving on Django 2.0

I've incorporated django-adminplus to my site and it's working great, however when running tests Django is not able to resolve my models. I see:

ImportError: cannot import name <MyModel>

This is using Python 3.4 on Django 2.0

Rename the module to django_adminplus

Similar to jsocol/django-ratelimit#214, in the year of the Barbie movie 2023, it would be good behavior with neighbors to rename the module from adminplus to django_adminplus. This won't change the name of the package for the purposes of PyPI, but will change the import path from import adminplus to import django_adminplus. Namespacing the package this way plays more nicely with other packaging ecosystems

Feature: Custom group names

It would really help us if we could easily rename the Custom Views section as the pages we are putting in there don't really fit with that. Maybe a setting that is passed into the template?

It would also be really good if we could have multiple groups or even better add to existing application/model groups.

What to replace

In the instructions it says:
To use AdminPlus in your Django project, you'll need to replace django.contrib.admin.site, which is an instance of django.contrib.admin.sites.AdminSite. I recommend doing this in urls.py right before calling admin.autodiscover():

Where is django.contrib.admin.site ? It is not in the urls.py in the example below. Also, what should it be replaced with?

Django 2.x support

Hi, I'd love to see django 2.x get integrated. As far as I can tell there's a PR waiting from January 2018 #58 to support 1.10+ that just doesn't get merged. This package renders unusable for me unless something is done to support 2.1. I'm doing everything by the book and still getting the infamous django.urls.exceptions.NoReverseMatch: Reverse for 'app_list' with keyword arguments '{'app_label': ''}' not found.

Template different to main site

We have noticed a few differences between the adminplus template and the standard django admin.

On all our custom views we loose our logout links, have tried to have a look in the templates but can't figure out what is causing them to disappear..

We also had to pass through our customised titles and headings, it would be excellent if the template picked up on the original values so each view didn't have to respecify them

Upgrade the link TD to TH

To match the style of the model links the each item should be in a TH rather than a TD.

Will submit a pull request :)

Django 1.8.7 register decorator didn't work

We had one model that was using the decorator rather than the explicit call and after adding adminplus that model disappeared from our admin screens.

Changing it over to the other call worked although I thought I read that it should have worked so not sure I think there must be a bug there.. Happy to investigate further if someone can point me in the right direction.

Custom path requires app name in Django 1.4

From the docs:

def my_view(request, *args, **kwargs):
   pass
admin.site.register_view('somepath', my_view)

Now my_view will be accessible at admin/somepath and there will be a link to it in the Custom Views section of the admin index.

This doesn't seem to work in Django 1.4

Instead of somepath, the custom path needs to be appname/somepath and will be accessible at admin/appname/somepath

No module named "SimpleAdminConfigdjango"

Hello, don't work for me
Django 1.11.9 and python3.5 but don't use virutalenv
I follow your tutorial
File "/Users/joelalves/Library/Python/3.5/lib/python/site-packages/django/apps/config.py", line 120, in create mod = import_module(mod_path) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked ImportError: No module named 'django.contrib.admin.apps.SimpleAdminConfigdjango'; 'django.contrib.admin.apps' is not a package

List custom views under app

It would be great if it were possible/default for custom views to be listed inside the app they belong to, rather than "global"

Django 1.9

Hi, i've been trying to use this module with Django 1.9, but overriding admin.site in urls.py causes the 'disappereance' of all the links in the index, my guess is that it's not registering the models and admins in admin.py
Any ideas? Any extra info i could provide?

Thanks!

How to hide the custom view from admin main page

As my custom view is linked with the urls inside one of the model views so, it requires variable to process the view. And when I am clicking on the custom view of the front page, its giving error as that link doesnt have required variable to process the view.
screenshot from 2017-11-20 14-38-22

So, is there a way to hide the custom view "TaxanomyTree" ??

Thanks! in advance.

Overwrite the custom list admin style.

I'm using django-suit, and I have a problem with the style between django-suit and this plugin.
The "Custom Views" look like this: custom view

And looking at the code it looks like it doesn't have the same classes the default blocks have. Is there a way to, apart from fixing this in the code, being more modular? Like the blocks you can overwrite them in the admin? I'll try and do a pull request for fix this, but it would be better to have something more modular to being able to customize it.

Testing

Using django adminplus makes testing a bit awkward. Since the docs recommend putting

from adminplus.sites import AdminSitePlus

admin.site = AdminSitePlus()

in urls.py, they're not loaded during testing. What I've been doing is this:

if not isinstance(admin.site, AdminSitePlus):
    admin.site = AdminSitePlus()

try:
    register_admin(Stuff, StuffAdmin)
    admin.site.register_view('stuff/csv_upload/', 'Stuff CSV Upload', view=upload_csv)
except admin.sites.AlreadyRegistered as e:
    logging.getLogger('django').warn("%s: %s", type(e).__name__, str(e))

I don't want to load urls.py for testing and I am not a huge fan of my current solution. Any ideas?

Completely broken on Django 1.9.5

FYI, I followed the installation instructions including the information in #42 on Django 1.9.5 and either it's missing all the core modules, says I have no permissions to do anything in the admin despite being a superuser, or cannot find admin.site.register_view function at all when trying to register a custom function.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.