Coder Social home page Coder Social logo

mishbahr / django-modeladmin-reorder Goto Github PK

View Code? Open in Web Editor NEW
258.0 258.0 83.0 40 KB

Custom ordering for the apps and models in the admin app.

Home Page: https://pypi.python.org/pypi/django-modeladmin-reorder/

License: BSD 3-Clause "New" or "Revised" License

Python 81.60% Makefile 12.18% HTML 6.23%

django-modeladmin-reorder's People

Contributors

bashu avatar bruun avatar dvarrazzo avatar hasb4k avatar mishbahr avatar zhangkaizhao 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  avatar

django-modeladmin-reorder's Issues

Admin "AUTHENTICATION AND AUTHORIZATION" replaced with a second set of my App and Tables in Admin

Hello,

I added the modeladmin-reorder add-on and afterwards the Authentication and Authorization piece of http://localhost:8000/admin/ was replaced with a second set of my App (adaclients) and its model tables. I added the files to GitHub "https://github.com/anacrust/admin_reorder_issue". I can send/email you a screenshot if that helps.

Make sure in the GitHub code I posted the piece below isn't commented out.

MIDDLEWARE_CLASSES = [
...

'admin_reorder.middleware.ModelAdminReorder',

...
]

Thank you,
Matt

No Effect

I followed the install steps, and tried a simple:

ADMIN_REORDER = (

# Rename app
{'app': 'auth', 'label': 'Authorization'},

)

But nothing changed. Is it case sensitive? Or is it that I'm on Django 1.2?

Usage

How do you arrange apps on the screen, and items within the apps? It wasn't clear to me from the documentation.

Users and user groups are not visible in the admin

I find a question.When using components to sort the module navigation bar in the background, I found that the user and user group modules disappeared, and then added 'auth.User','auth.Group' in ADMIN_REORDER = {(...)}, but still nothing Show them, how can I fix it? I'm using Django3.2.4 LTS

can't install with pip3

I am trying to install this package using the following command:
pip3 install django-modeladmin-reorder. I have encountered the following error:
Collecting django-modeladmin-reorder
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fc8ba0365f8>
: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/django-modeladmin-reorder/
(this message appears several times)
Stack: Python 3.5.2 Django 1.11.17

Handle admin sidebar in Django 3.1

Starting from 3.1, Django has a sidebar in the admin. The sidebar looks very much like the apps and models list on admin dashboard. Perhaps django-modelsadmin-reorder should handle the sidebar as well, so that it lists the same models as on the dashboard.

Select_site_to_change___STEMI

missing built in apps in admin (cannot reference apps by app name/module)

We generate our ADMIN_REORDER setting like this:

ADMIN_EXCLUDE_APPS = ()

ADMIN_REORDER = (
    'designer',
)
ADMIN_REORDER += tuple(filter(lambda app: app not in ADMIN_EXCLUDE_APPS + ADMIN_REORDER, INSTALLED_APPS))

ADMIN_REORDER contains this after population (as expected)

('designer', 'modeltranslation', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sites', 'allauth', 'allauth.account', 'allauth.socialaccount', 'allauth.socialaccount.providers.google', 'allauth_invite', 'dolphin', 'bootstrapform', 'django_countries', 'django_tables2', 'django_filters', 'reversion', 'djcelery', 'kombu.transport.django', 'admin_reorder', 'django_slack', 'django_extensions', 'customer', 'subscriber', 'backoffice', 'debug_toolbar')

Visiting admin, only our own apps, and some third party apps (like djcelery) are displayed in the admin.

I checked the middleware, and it renames the apps using the label. Is that expected behavior? Shouldn't one be able to reference the app name as a module? Adding for example auth to the ADMIN_REORDER, makes django.contrib.auth pop up...

Support Non-ASCII character in labels

I tried to customize a label in spanish bu couldn't. I got this error:
SyntaxError: Non-ASCII character '\xc3' in file /Users/username/myproject/settings.py on line xxx, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
I am using OS X EL Capitan

No longer appears to work with Django 2.X + Python 3

The only example in the configuration of ADMIN_REORDER that works is using the app name with no other customization, e.g., 'site'. Every other configuration results in nothing showing up.

Does anyone know of a replacement app that has this functionality that is being maintained?

Enhancement: Custom URL for grouping

@mishbahr Thank you for putting up this gem of Django extension. It is a lifesaver when you got a project with 50+ models to administer.

A minor improvement could be to provide a custom url for renamed apps/model grouping.
Right now renaming a model will not change the link to it.
Often times you may want to use django-modeladmin-reorder to group an apps' models to provide structure to the admin site. Especially when including into a navigation bar it would come handy to jump to a specific group right away.

Possible configuration example for grouping models of an app into GroupOne and GroupTwo, each retrievable by its distinct URLs.

ADMIN_REORDER = (
    {
        'app': 'sites',
        'label':''GroupOne',
        'url': 'groupone'
        'models': ('auth.ModelOne', 'auth.ModelTwo')},
   },
    {
        'app': 'sites',
        'label':''GroupTwo',
        'url': 'grouptwo'
        'models': ('auth.ModelThree', 'auth.ModelFour')},
   },
)

Feature request

Hi,
I wish this application had two minor extra featues;

  • collapsable, expandable admin menu
  • view links in admin menu

I thank all the contributors.

Re ordering not happening

I installed the django-modeladmin-reorder using pip. Included admin_reorder in my INSTALLED_APPS and also 'admin_reorder.middleware.ModelAdminReorder' to my MIDDLEWARE_CLASSES. Below is my ADMIN_REORDER section

ADMIN_REORDER = (
    # Other
    {
        'app': 'auth',
        'label': 'Authentication and Authorization',
        'models': ('auth.Group', 'auth.User', )
    },
    {
        'app': 'other',
        'label': 'Payments',
        'models': ('other.Currency', 'other.ExchangeRate', 'other.PaymentMethod', )
    }, 
    {
        'app': 'other',
        'label': 'POS Management',
        'models': ('other.DeviceInfo', 'other.Environment', )
    }, 
    {
        'app': 'other',
        'label': 'Reason Codes',
        'models': ('other.ReasonCodeCategory', 'other.ReasonCode')
    }

)

This doesnot give the desired output. Where am I going wrong ?

Is this project still active?

Hi, @mishbahr

I really love this project, it is very useful in many situations, but I have seen that there is no activity for almost a year. So, if you don't have time to maintain it I would like to do the task.

Breadcrumbs are not renamed

First of all, thanks for this great little project! It makes the django admin look a lot more logical to my users. However, I have noticed the following incorrect behavior:

After renaming apps and models using the {'label': 'New label'} syntax, the breadcrumbs shown in the top left corner of the django admin still have the original name. I'm using Python 3.4.2, Django 1.7, and django-modeladmin-reorder 0.1.2

Clarify supported versions?

I can't see anything in the documentation, or a badge which would indicate the intended supported versions of either Python or Django.

According to the tox.ini and .travis.yml and the trove classifiers on PyPI, I might expect this to run on python2 but I don't think that can be the case, because trying to import/use admin_reorder.middleware.ModelAdminReorder yields an exception:

  File "/PATH/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/PATH/lib/python2.7/site-packages/admin_reorder/middleware.py", line 9, in <module>
    except ModuleNotFoundError:
NameError: name 'ModuleNotFoundError' is not defined

ModuleNotFoundError is new in python3.6 and is a subclass of the normal ImportError machinery ordinarily used to test for where things like the resolve function are.

I'd chalk it up as only supporting python3 but the last commit (38283ae) indicates the intention to support older versions, so I'm unsure :)

Breadcrumb urls lead to error page

Thansk for this package

Here is a little buglet : when I group models together under a single app-name, clicking on "cross referenced" models will lead to a page where their breadcrumb still references their real parent app. Clicking on this url will lead to an empty page, since the origianl app of these models is not listed in ADMIN_REORDER.

django-modeladmin-reorder 0.3, 0.3.1 not work

python 2.7, Django 1.9.9, django-modeladmin-reorder 0.3, 0.3.1

File "/home/pluton/Projects/Coffee/woolhouse/env/local/lib/python2.7/site-packages/admin_reorder/middleware.py", line 9, in
except ModuleNotFoundError:
NameError: name 'ModuleNotFoundError' is not defined

KeyError on attribute app["app_label"]

Hi @mishbahr

I'm using 0.1.3 version of admin_reorder, since the project I'm handling have legacy transaction code that requires django 1.5.1. For some reason I can't get this to run because of KeyError in middleware.py:

     # Flatten all models from apps
     self.models_list = []
     for app in app_list:
         for model in app['models']:
             model['model_name'] = self.get_model_name(
                 app['app_label'], model['object_name'])
             self.models_list.append(model)

From the above snipet, I not only missing app['app_label'], I am also missing model['object_name'].

This is the content I have for app:

{'app_url': '/admin/auth/', 'models': [{'perms': {'add': True, 'change': True, 'delete': True}, 'add_url': '/admin/auth/group/add/', 'admin_url': '/admin/auth/group/', 'name': <django.utils.functional.proxy object at 0x7f70f35f9c50>}, {'perms': {'add': True, 'change': True, 'delete': True}, 'add_url': '/admin/auth/user/add/', 'admin_url': '/admin/auth/user/', 'name': <django.utils.functional.proxy object at 0x7f70f35e0710>}], 'has_module_perms': True, 'name': u'Auth'}

Is this because I'm using an old django version, or am I missing something?

Thanks,
John

Keep admin.site.register models

Thanks for the application!

How we can keep showing admin.site.register models without listing it in ADMIN_REORDER?

For example, we have

admin.site.register(app1.Model)
admin.site.register(app2.Model)
admin.site.register(app3.Model1)
admin.site.register(app3.Model2)

ADMIN_REORDER = (
       # Reorder app models
    {'app': 'app3', 'models': ('app3.Model1', 'app3.Model2')},
)

I want to show app1.Model and app2.Model in admin too (without ordering), without select it in manual mode.

Does work correctly with django permissions.

Hey, thanks for building this.
So, I noticed that if you have a order defined and a certain model is not in that order but the user has explicit django permission to see/change it, the model will show up regardless.

That's a bug, right?

Customizing template

Is it possible to further customize the template manually?

Is it just a case of copying the main template from the repo into one's own /templates/admin and going from there?

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.