Giter Club home page Giter Club logo

django-admin-interface's Introduction

django-admin-interface

django-admin-interface is a modern responsive flat admin interface customizable by the admin itself.

django-admin-interface-preview

Features

  • Beautiful default django-theme
  • Themes management and customization (you can customize admin title, logo and colors)
  • Responsive
  • Related modal (instead of the old popup window)
  • Environment name/marker
  • Language chooser
  • Foldable apps (accordions in the navigation bar)
  • Collapsible fieldsets can have their initial state expanded instead of collapsed
  • NEW Collapsible inlines
  • NEW Tabbed fieldsets and inlines
  • NEW List filter removal links
  • NEW List filter highlight selected options
  • List filter dropdown
  • List filter sticky
  • Form controls sticky (pagination and save/delete buttons)
  • Compatibility / style optimizations for:
    • django-ckeditor
    • django-dynamic-raw-id
    • django-json-widget
    • django-modeltranslation
    • django-rangefilter
    • django-streamfield
    • django-tabbed-admin
    • sorl-thumbnail
  • Translated in many languages: de, es, fa, fr, it, pl, pt_BR, ru, tr

Installation

  • Run pip install django-admin-interface
  • Add admin_interface and colorfield to settings.INSTALLED_APPS before django.contrib.admin
INSTALLED_APPS = (
    #...
    "admin_interface",
    "colorfield",
    #...
    "django.contrib.admin",
    #...
)

X_FRAME_OPTIONS = "SAMEORIGIN"
SILENCED_SYSTEM_CHECKS = ["security.W019"]
  • Run python manage.py migrate
  • Run python manage.py collectstatic --clear
  • Restart your application server

Warning

if you want use modals instead of popup windows, ensure to add X_FRAME_OPTIONS = "SAMEORIGIN" setting.

Optional features

To make a fieldset start expanded with a Hide button to collapse, add the class "expanded" to its classes:

class MyModelAdmin(admin.ModelAdmin):
    # ...
    fieldsets = [
        ("Section title", {
            "classes": ("collapse", "expanded"),
            "fields": (...),
        }),
    ]
    # ...

Optional themes

This package ships with optional themes as fixtures, they can be installed using the loaddata admin command. Optional themes are activated on installation.

Django theme (default):

Run python manage.py loaddata admin_interface_theme_django.json

Bootstrap theme:

Run python manage.py loaddata admin_interface_theme_bootstrap.json

Foundation theme:

Run python manage.py loaddata admin_interface_theme_foundation.json

Run python manage.py loaddata admin_interface_theme_uswds.json

Add more themes

You can add a theme you've created through the admin to this repository by sending us a PR. Here are the steps to follow to add:

  1. Export your exact theme as fixture using the dumpdata admin command: python manage.py dumpdata admin_interface.Theme --indent 4 -o admin_interface_theme_{{name}}.json --pks=N

  2. Copy the generated json file into the fixtures folder (making sure its name starts with admin_interface_theme_ to avoid clashes with fixtures that might be provided by other third party apps).

  3. Remove the pk from the fixture and make sure the active field is set to true (in this way a theme is automatically activated when installed).

  4. Edit the section above to document your theme.

Add theme support to third-party libraries

You can add theme support to existing third-party libraries using the following CSS variables:

Header

  • --admin-interface-header-background-color
  • --admin-interface-header-text-color
  • --admin-interface-header-link-color
  • --admin-interface-header-link_hover-color
  • --admin-interface-title-color
  • --admin-interface-env-color

Logo

  • --admin-interface-logo-color
  • --admin-interface-logo-default-background-image
  • --admin-interface-logo-max-width
  • --admin-interface-logo-max-height

Modules / Links

  • --admin-interface-module-background-color
  • --admin-interface-module-background-selected-color
  • --admin-interface-module-border-radius
  • --admin-interface-module-text-color
  • --admin-interface-module-link-color
  • --admin-interface-module-link-selected-color
  • --admin-interface-module-link-hover-color
  • --admin-interface-generic-link-color
  • --admin-interface-generic-link-hover-color
  • --admin-interface-generic-link-active-color

Buttons

  • --admin-interface-save-button-background-color
  • --admin-interface-save-button-background-hover-color
  • --admin-interface-save-button-text-color
  • --admin-interface-delete-button-background-color
  • --admin-interface-delete-button-background-hover-color
  • --admin-interface-delete-button-text-color

Related Modal

  • --admin-interface-related-modal-background-color
  • --admin-interface-related-modal-background-opacity
  • --admin-interface-related-modal-border-radius
  • --admin-interface-related-modal-close-button-display

Screenshots

Admin login

django-admin-interface_login

Admin dashboard

django-admin-interface_dashboard

Admin themes management

django-admin-interface_themes_management

Admin theme customization

django-admin-interface_theme_customization

Localization

At the moment, this package has been translated into the following languages: de, es, fa, fr, it, pl, pt_BR, tr.

Translate into another language

  • Run python -m django makemessages --ignore ".tox" --ignore "venv" --add-location "file" --extension "html,py" --locale "it" (example for Italian localization)

  • Update translations in admin_interface/locale/it/LC_MESSAGES/django.po

  • Run python -m django compilemessages --ignore ".tox" --ignore "venv"

Update translations

If you do some changes to the project, remember to update translations, because if the translations files are not up-to-date, the lint step in the CI will fail:

  • Run tox -e translations

Caching

This package uses caching to improve theme load time and overall performance. You can customise the app caching options using settings.CACHES["admin_interface"] setting, otherwise the "default" cache will be used:

CACHES = {
    # ...
    "admin_interface": {
        "BACKEND": "django.core.cache.backends.locmem.LocMemCache",
        "TIMEOUT": 60 * 5,
    },
    # ...
}

Warning

There is a known compatibility issue when using this package with django-redis, more specifically, using the JSONSerializer the following error is raised: TypeError: Object of type Theme is not JSON serializable, to mitigate this problem, simply use a specific cache for this app that does not use any json serializer.

FAQ

Custom base-site.html

I already have a custom base_site.html, how can I make it work?

You can use django-apptemplates, then add {% extends "admin_interface:admin/base_site.html" %} to your base_site.html

Custom LocaleMiddleware warning

I'm using a django.middleware.locale.LocaleMiddleware subclass, but I see an unnecessary warning for missing django.middleware.locale.LocaleMiddleware, what can I do?

You can simply ignore the warning (this has been discussed here)

import warnings

warnings.filterwarnings("ignore", module="admin_interface.templatetags.admin_interface_tags")

Language Chooser not showing

I have enabled the Language Chooser, but it is not visible in the admin, what should I do?

You must configure multilanguage settings and urls correctly:

LANGUAGES = (
    ("en", _("English")),
    ("it", _("Italiano")),
    ("fr", _("Français")),
    # more than one language is expected here
)
LANGUAGE_CODE = "en"
USE_I18N = True
MIDDLEWARE = [
    # ...
    "django.middleware.locale.LocaleMiddleware",
    # ...
]
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.urls import include, path

# ...

urlpatterns = [
    path("i18n/", include("django.conf.urls.i18n")),
]
urlpatterns += i18n_patterns(path("admin/", admin.site.urls))

Open any url in modal window

I have an application with some cross-links in the admin and I would like to open them in modal windows instead of same/new window, how can I do?

You just need to add _popup=1 query-string parameter to the urls:

url = reverse(f"admin:myapp_mymodel_change", args=[mymodel_instance.pk])
url = f"{url}?_popup=1"

Testing

# clone repository
git clone https://github.com/fabiocaccamo/django-admin-interface.git && cd django-admin-interface

# create virtualenv and activate it
python -m venv venv && . venv/bin/activate

# upgrade pip
python -m pip install --upgrade pip

# install requirements
pip install -r requirements.txt -r requirements-test.txt

# install pre-commit to run formatters and linters
pre-commit install --install-hooks

# run tests
tox
# or
python runtests.py
# or
python -m django test --settings "tests.settings"

Contributing

Contributions are always welcome, please follow these steps for submitting good quality PRs:

  • Open an issue, please don't submit any PR that doesn't refer to an existing issue.
  • 💻 Work on changes, changes should preferably be covered by tests to avoid regressions in the future.
  • 🌐 Update the translations files.
  • 🧪 Run tests ensuring that there are no errors.
  • 📥 Submit a pull-request and mark it as "Ready for review" only if it passes the CI.

License

Released under MIT License.


Supporting

See also

  • django-colorfield - simple color field for models with a nice color-picker in the admin. 🎨

  • django-extra-settings - config and manage typed extra settings using just the django admin. ⚙️

  • django-maintenance-mode - shows a 503 error page when maintenance-mode is on. 🚧 🛠️

  • django-redirects - redirects with full control. ↪️

  • django-treenode - probably the best abstract model / admin for your tree based stuff. 🌳

  • python-benedict - dict subclass with keylist/keypath support, I/O shortcuts (base64, csv, json, pickle, plist, query-string, toml, xml, yaml) and many utilities. 📘

  • python-codicefiscale - encode/decode Italian fiscal codes - codifica/decodifica del Codice Fiscale. 🇮🇹 💳

  • python-fontbro - friendly font operations. 🧢

  • python-fsutil - file-system utilities for lazy devs. 🧟‍♂️

django-admin-interface's People

Contributors

anatolzak avatar carlosmonari avatar cereigido avatar dependabot[bot] avatar derzinn avatar fabiocaccamo avatar github-actions[bot] avatar ishakoktn avatar jonlev1n avatar julianwachholz avatar leandromsd avatar merwok avatar mintypt avatar mjwalter avatar mneipp avatar monkeywithacupcake avatar mounirmesselmeni avatar mustafaabughazy avatar natmil avatar paduszyk avatar pooyamb avatar pre-commit-ci[bot] avatar rdurica avatar smunoz-ml avatar thesinner avatar timgates42 avatar unusual-thoughts avatar vazark avatar zodiacfireworks avatar zyv 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-admin-interface's Issues

Don't hard-code media type for favicon

Hello! The template hard-codes type="image/x-icon" for the link rel=icon.
Specs and browsers don’t require to use the Microsoft ICO file format; PNG is a very common choice I think.

If the attribute must be present (I forgot), it should be accurate depending on the image used.

More base themes

This Django app is amazing, such a great idea. We have several sites running with Django and we are starting using it to avoid confusion between sites and environments (local/test/live...). For my use case, it would make this even easier to deploy if there were a few more themes built in.

I'm no designer so my first experimentations were a bit disappointing. I ended up with a theme inspired by Bootstrap's docs site, and I'd happily contribute back here. Would you be open to receive more themes? I was thinking of adding a fixtures that one would optionally load using:

python manage.py loaddata super_duper_theme.json

Then add a screenshot somewhere to document the theme's existence in the README? Do you have more docs somewhere?

Reverse for 'set_language' not found

I just installed this package on a new project im working on, howerver im getting the following error:

NoReverseMatch at /admin/
Reverse for 'set_language' not found. 'set_language' is not a valid view function or pattern name.

Full Debug Info

Version 0.4.2 is incompatible with django-storages

We deployed this on our live site today and it crashed our whole admin site, due to this change a09e13f#diff-e561f32039c364b52846f6a4931fd449R110

It crashing because we use S3 as media storage (from django-storage), which does not implement the Storage.path method, as per the Django base class docstring:

Returns a local filesystem path where the file can be retrieved using Python's built-in open() function. Storage systems that can't be accessed using open() should not implement this method.

Reverting to the previous version of django-admin-interface (0.4.1) fixed the problem.

Import external CSS

At the moment, inline CSS are supported using the css attribute inside the JSON configuration file.

It would be great to have the possibility to also import an external CSS file.

Use modal for search dialog of raw_id_fields, too

  • modal for add/edit and other popups is very nice
  • currently the popup to search records for raw_id_fields widget (opened via the magnifying glass icon) still uses the old popup
  • it would be rad if it worked the same way!

Logo image not showing

I'm new to django, I installed and applied the USWSD theme on my site, but the logo image is not showing and when i enter the editing page for the theme and click on the link for the logo, this error mesage shows up: "Theme with ID "3/change/admin-interface/logo/akua%b65YP.gif" doesn't exist. Perhaps it was deleted?", i tried to change the static folder to various locations on the settings.py but nothing worked to make the image show u, is there a limit to the size of th logo or a restriction about its format? my logo file is a .gif with 64x47 size and weights 4kb.

my settings.py looks like this (the static related stuff is at the bottom):

import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(file)))

SECRET_KEY = 'spam'

DEBUG = True

ALLOWED_HOSTS = []

INSTALLED_APPS = [
'admin_interface',
'colorfield',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rules'
]
AUTHENTICATION_BACKENDS = (
'rules.permissions.ObjectPermissionBackend',
'django.contrib.auth.backends.ModelBackend',
)
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'resil_rules_BAD3.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'resil_rules_BAD3.wsgi.application'

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

PROJECT_DIR = os.path.dirname(os.path.abspath(file))
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')

STATIC_URL = '/static/'

Feature request: specify favicon

It would be nice if it was possible to specify the favicon of the admin interface without extending any template.

Thanks,
Jakob

Django 1.10 error

django.core.exceptions.SuspiciousFileOperation: The joined path ([...]/.virtualenvs/intranet/lib/python2.7/site-packages/admin_interface/data/logo-django.svg) is located outside of the base path component ([...]/media)

Clean up packaging

Hello! I noticed a few places where setup.py is doing a lot more work than required

Custom base_site.html

Thank you for this awesome KISS plugin!

I have a custom base_site.html, how can I make it work?

raw_id_fields issue

Hi and thanks for this wonderful addon.

I have an admin class like this:

class CustomerAdmin(admin.ModelAdmin):
    raw_id_fields = ('locality', )

which results in
screenshot_2018-11-13_01-53-35

Clicking on the search icon I guess it should open a modal or the popup, but I get this error in Chrome console.

01:57:27.119 jquery.js:9857 Uncaught TypeError: url.indexOf is not a function
    at jQuery.fn.init.jQuery.fn.load (jquery.js:9857)
    at HTMLAnchorElement.presentRelatedObjectModal (related-modal.js?v=0.8.1:89)
    at HTMLAnchorElement.dispatch (jquery.js:5183)
    at HTMLAnchorElement.elemData.handle (jquery.js:4991)
jQuery.fn.load @ jquery.js:9857
presentRelatedObjectModal @ related-modal.js?v=0.8.1:89
dispatch @ jquery.js:5183
elemData.handle @ jquery.js:4991

Django 2.1.3. Any idea?

Initial Update

Hi 👊

This is my first visit to this fine repo, but it seems you have been working hard to keep all dependencies updated so far.

Once you have closed this issue, I'll create seperate pull requests for every update as soon as I find one.

That's it for now!

Happy merging! 🤖

Better releases

  • make sure to update translations before releases
  • write a changelog
  • write upgrade notes in the github release page

Image not loading

Hello, my I am trying to change the logo and it is not working. Is there a configuration I am missing?

Thanks

I18n?

Hi,

Are there immediate plans for internationalization?

Form fields sizing and layout

It would be nice if it was possible to customise the form field sizing and layout.

For example to autosize the fields based upon the fieldsets definition so everything looks neat and aligned. Is there a way to do this already?

'renderer' argument is required for future Django versions

Using Django 2.1b1, the following error arises when accessing a theme change view.

TypeError at /admin/admin_interface/theme/1/change/
render() got an unexpected keyword argument 'renderer'

As noted in 2.1 release notes:

Support for Widget.render() methods without the renderer argument is removed.

Install django-flat-{theme,responsive} only when needed

With recent django versions, it is not necessary to install django-flat-theme and django-flat-responsive. They could be removed from requirements, and either installed manually by people (with instructions in the docs), or maybe extras could be used for a more convenient install method.

Missing title

In this file
django-admin-interface/admin_interface/templates/admin/base_site.html
You forgot to override the title block which caused the admin site title to disappear.

You should add this block to the file
{% block title %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %}

Django 1.9 support

Hi,
In django 1.9 the admin theme was updated. This project support django 1.9? If not, do you plan to include support soon?

migrate fails at "change_related_modal_background_opacity_type"

Hi there. Thanks for the great interface. I'm trying to migrate from a function setup with Python 3.6, Django 2.1.5, and admin-interface 0.9.1 . When I run migrate on my development computer I end up with the following traceback. I'm happy to help debug but the process of debugging if I can.

` Applying admin_interface.0008_change_related_modal_background_opacity_type...Traceback (most recent call last):
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
psycopg2.OperationalError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/migrations/migration.py", line 124, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/migrations/operations/fields.py", line 216, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 523, in alter_field
old_db_params, new_db_params, strict)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/postgresql/schema.py", line 122, in _alter_field
new_db_params, strict,
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 663, in _alter_field
params,
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 133, in execute
cursor.execute(sql, params)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/utils.py", line 100, in execute
return super().execute(sql, params)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/utils.py", line 68, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/utils.py", line 89, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
django.db.utils.OperationalError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
self.connect()
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/base/base.py", line 194, in connect
self.connection = self.get_new_connection(conn_params)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/postgresql/base.py", line 178, in get_new_connection
connection = Database.connect(**conn_params)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/psycopg2/init.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: FATAL: the database system is in recovery mode

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "manage.py", line 30, in
execute_from_command_line(sys.argv)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/core/management/init.py", line 381, in execute_from_command_line
utility.execute()
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/core/management/init.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
output = self.handle(*args, **options)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 203, in handle
fake_initial=fake_initial,
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/migrations/executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 108, in exit
self.atomic.exit(exc_type, exc_value, traceback)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/transaction.py", line 256, in exit
connection.set_autocommit(True)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/base/base.py", line 394, in set_autocommit
self.ensure_connection()
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
self.connect()
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/utils.py", line 89, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
self.connect()
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/base/base.py", line 194, in connect
self.connection = self.get_new_connection(conn_params)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/django/db/backends/postgresql/base.py", line 178, in get_new_connection
connection = Database.connect(**conn_params)
File "/home/ace/.local/share/virtualenvs/website-10j77PrM/lib/python3.6/site-packages/psycopg2/init.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: FATAL: the database system is in recovery `mode``

Cancel button does not work

Although commit e3811e2 fixes cancel button in case of modals, it seems to break that functionality for simple pages (like when you press delete button on object edit page and end up on confirmation page)

Add button to close modal

Hello! Thanks for this extension, it is very nice and works just as advertised.

A co-worker suggested that adding a close button to the modal (a small in a corner) would be good user interface!

(I am also used to pressing Escape to close modals, but maybe that would make it too easy to lose unsaved data)

"pencil" icon not working

Hi,
After adding django-admin-interface to the installed_apps, nothing happens when I click the "pencil" and "add" icons in a change form of django admin.

Django version is 1.11 and python 2.7

Thanks for help.

django-dynamic-raw-id whith django-admin-interface

Hi again Fabio,

when we use a external package django-dynamic-raw-id (https://github.com/lincolnloop/django-dynamic-raw-id) whith django-admin-interface,

exist a error in the new window invoked to select a register.

the new window is not closed after select a register.

this bug occur like as described in March 21 (raw-id-field whith django-admin-interface issue #58)

this error occurr in all browser's (IE, Chrome, Firefox ...)

i use to develop:
django 2.1
python 3.7

Thanks again.

Custom logo does not work.

I tried to upload custom logo (d.png)

Result:

  • File uploaded to [project dir]/admin-interface/logo/d.png
  • On table admin_interface_theme logo="admin-interface/logo/d.png" (without slash)
  • Browser tried to get logo as (and failed)
    /[ROOT_URL]/admin/[ROOT_URL]/[modelname]/admin-interface/logo/d.png
  • Trying to get /admin-interface/logo/d.png → also fail.
    Probably we should somehow add logo directory to urls?
  • "collectstatic --clear" does not help.

Environment colors are backward

Hello! I noticed the fun little favicon change in the latest release.

I used to do something similar with django-admin-env notice¹ before I found django-admin-interface. However, the colors I configured went in the opposite directions than the ones here: blue or green for test/dev envs, orange for staging (be careful but not real site), red for prod (be careful! this is the important one).

¹ https://github.com/dizballanze/django-admin-env-notice#screenshots

Would you consider either changing the colors, or making them customizable by the site (either statically in django setings, or as part of the theme object)?

Related request: could there be a checkbox in the theme to opt-in/opt-out of the favicon modification (in case people already have different favicons per env, or if the circle makes the icon not pretty)

Thanks for considering this!

Relative or absulte path for logo and favicon

Hi,

We noticed that the logo and favicon have to be hosted by the app itself.

Sadly we are running our django-admin site in a cluster, so if I upload the logo, it will be loaded on a certain machine, not the others, making the upload feature a bit useless. It auto scales, so machines are deleted and created.

We could include this pre-loaded in the cluster image, but it would be nice to have an option to just put an url in this field and read it from the web.

raw-id-field whith django-admin-interface

Hi my dearest friend,

when we use raw-id-field whith django-admin-interface, exist a error in the new window invoked to select a register. the new window is not closed after select a register.

this error occurr in all browser's (IE, Chrome, Firefox ...)

i use to develop:
django 2.1
python 3.7

Multiple copies of django-logo.svg created

When using this library with django-storages and AWS_S3_FILE_OVERWRITE=True, the library creates (a lot of) copies of the image django-logo.svg. We had 20,000+ created in a few weeks time.

This django-storages setting is to make sure that an upload of a file will not override existing file. It's useful as many people might upload a file called "photo.jpg" for different purposes.

I suspect is due to the Theme.get_active_theme() which is used in many places:

  • post_migrate signal
  • post_save signal
  • post_delete signal
  • template tag

Also, get_active_theme, might call set_active, which calls save, which calls get_active_theme. Looks like there might be a case where it's called several times in a loop. From an API standpoint, it's a lot of things for a method which apparently is just "getting" something.

Maybe it would make more sense to not do too many things in that get_active_theme method, separate the auto-updates in a setter method and provide sensible defaults in the templates if no theme is provided (using {{ color|default:"#0C4B33" }})?

Sorry for the long issue, happy to discuss further as well as helping with the implementation.

Calendar bug

Hi, when i click in day on the calendar, the console javascript display this message.

image

This is an error of theme or of django?

Thanks!

Cache admin settings

Each call to Theme.get_active_theme makes multiple database calls. Unfortunately, that's called in the get_admin_interface_theme template tag, which appears multiple times on each admin page render.

We should cache these calls at least per request to speed up performance.

Avoid pinning dependencies (Discussion)

Pinning dependencies to specific versions of upstream libraries is a good practice when we're writing an app, but not as useful when writing a library. If our dependencies are too strict, the users of our library may see a conflict with their own application (or another library).

Currently, we pin versions of django-colorfield, django-flat-theme, and django-flat-responsive. I propose we instead specify minimum and maximum bounds.

What do you all think?

The version 0.4.6 is not creating the "0006_bytes_to_str.py" migration file.

Hello.

The version 0.4.6 when it is installed is not creating the "0006_bytes_to_str.py" migration file. In the development environment this is not a problem, since the makemigration command generates the file. But I'm having problems in the production environment in Heroku, because it installs django-admin-interface during the deploy and the migrate command only runs the five available migration files. I can not run a makemigrations directly on Heroku. Can you help me?

Related modal does not close

Whenever the save button on related modal is clicked, the new record is saved but the modal doesn't close.
screenshot 2019-03-07 at 11 43 26 am
Keeps on showing this

Missing migration in release 0.9.0

Hi

I think there is a migration missing in the current release 0.9.0 (migration 0010 for altering some fields). Could you run makemigrations and create a new patch release 0.9.1 with it?

Thank you for your effort!

Logo not showing though MEDIA_ROOT and MEDIA_URL are set

Unfortunately it does not run out of the box. I added

MEDIA_ROOT = os.path.join(BASE_DIR, 'admin_interface/public/media/')
MEDIA_URL = '/media/'

to settings.py, but the logo will be uploaded to

http://127.0.0.1:8000/media/admin-interface/logo/mylogo.svg

which leads to

[26/Mar/2019 21:55:52] "GET /media/admin-interface/logo/mylogo.svg HTTP/1.1" 404 2081

Do I have to adjust another setting? I'm using django 2.1 and the latest version of django-admin-interface which I installed with pip3 install django-admin-interface.

Related Modal not working when Clickjacking Protection is enabled

When django.middleware.clickjacking.XFrameOptionsMiddleware is used the modal is blocked and never shows up.

I had to disable the header for the admin pages in order to make it work, although the default setting is SAMEORIGIN.

By default, the middleware will set the X-Frame-Options header to SAMEORIGIN for every outgoing HttpResponse.

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.