I've just set up a new local version of my django application, and all working fine until I checked on the django admin.
127.0.0.1:8000/admin works fine and brings up the usual Django Admin homepage with full list of apps, but when I click into any of the individual app elements it breaks. The URL changes, but instead of displaying that app's admin site it shows an oddly rendered version of the admin homepage, with the app list collapsed on left side of screen (see screenshots below)
Can't immediately see which parts of codebase could be relevant here, so please request copies of any code you want to see.
The correctly displayed Django Admin homepage
How it renders when I click into any of the individual app/model admin sites
As above, with list of all apps expanded from left
This happened to me when I upgraded to django 3.1.
Set admin.site.enable_nav_sidebar = False on your admin.py file.
from django.contrib import admin
admin.site.enable_nav_sidebar = False
Actually the admin does load the pages for every model but the nav_sidebar takes all the space. If you zoom out long enough you'll see the models and forms are there.
Related
I have built a Django application with a custom interface. It hasn't been changed in a couple of years.
These (previous) servers are running Django 3.0.8.
Recently I set up a new server, and the Django Admin interface now shows the model list in a scrolling iframe, and long tables on the right side are also scrolled independently of the page.
This server is running Django 3.2.3.
I don't like the new interface, but it more importantly it will require an extensive rewrite of our custom admin css.
Can anyone point me to information about the change, or tell me if there is a setting to disable it?
I found the answer in this Stack Overflow answer. I will leave this question up because the other answer doesn't mention iframes.
Django 3.1 added the new scrolling sidebar in an iframe.
To disable it add the following to the root urls.py file:
from django.contrib import admin
admin.autodiscover()
admin.site.enable_nav_sidebar = False
The 3.1 Release Notes say:
The admin now has a sidebar on larger screens for easier navigation. It is enabled by default but can be disabled by using a custom AdminSite and setting AdminSite.enable_nav_sidebar to False.
Reference links from the original answer:
Django 3.1 release notes
The Django admin site
I am working on an existing django project where admin console is extensively used.
With my latest run of package upgrade for my application admin page layout has changed.
Models have started appearing on all the pages, leaving a small space to display form fields.
For example this is how form page look like now:
Original Form view was occupying the whole page like this:
Any clue on what has been changed and which setting to change to get back the original view?
From the django-3.1 release notes,
The admin now has a sidebar on larger screens for easier navigation.
It is enabled by default but can be disabled by using a custom
AdminSite and setting AdminSite.enable_nav_sidebar
to False.
You can refer Customizing the AdminSite class - (django doc) to know more about customizing the AdminSite
Try this, open your browser and clear all the history then login back in again and it should work. I am sure the browser has cached an old version of Django admin.
I had the same problem when using version 3.1. I started a new demo app with version 2.2 to demonstrate something and when I got back to version 3.1 I got that issue, So what I did was just clear the browser history and everything came to its original state.
I want to add some content on one of my Wagtail pages and I am trying to import that Wagtail page on all my other wagtail pages. The reason I am trying to do this is that if in the future I make a change on the content it should consistently reflect on all the other Wagtail pages.
Is there a way that I can import a Wagtail page on all my other Wagtail pages, if so please let me know.
Thanks in advance!
I have a website which has the following Configurations:
1) Django-2.0.8
2) Wagtail-2.2.4
A custom template tag is a good way to achieve this, as it provides a place to run custom Python code (for retrieving the necessary data) before outputting the results to the template, either directly as a string or by rendering a template. For example, if you had a footer_text field on a HomePage model, and wanted to display the footer text of the HomePage with slug 'home' on every page, you could define a custom tag as follows:
#register.inclusion_tag('myapp/includes/footer.html')
def footer():
homepage = HomePage.objects.get(slug='home')
return {'footer_text': homepage.footer_text}
You could also look at Wagtail's site settings module as a way to define global content to be re-used across a site (although it's missing a few features that you'd get from defining it on a page model, such as moderation workflow and revision history).
I'm not really sure what to share (i.e. which part of my application code) as I'm still a beginner with React so please bear with me.
I have a React application running on top of a Django application. Basically, there are Django Admin Panel URLS, REST API URLS in Django, and one path to catch all paths that don't belong to the first two groups.
I have a page (or a React Container) that calls Django's REST API to query all entries in the users DB Table. This part is okay but what I've noticed is, everytime I manually delete a row in the Django Admin Panel, the whole page refreshes. What are possible reasons for this?
By the way, I'm using Redux as well to manage the whole application state.
I've inherited some code that I need to add some new models (and admin models) to, and I've noticed a slight oddity.
There are several models within an app, that do not appear to the user on the admin interface on the app's section home page (the page you land on after logging in to the admin site), but that do appear on the app's page of admin site. It seems that when I add a new model to the app, and register it to the admin site, it behaves in this way.
Is this a feature of Django's admin that I'm not familiar with, or do I need to hunt for some custom code that's controlling this?
To be clear, imagine an app (called 'app'), with 2 models (Model1, and Model2) registered in the admin interface. You log into the admin site, and on the main page, you see the 'App' header, and underneath it, is only Model1. You click on the 'App' header, the breadcrumb nav now says "Home > App", and on that page you then see both Model1 and Model2. How has this been done? How can I configure it? Or is something broken?
I have discovered that in the INSTALLED_APPS there were several apps I wasn't familiar with, but two were called "grappelli" and "grappelli.dashboard".
Noticing furhter down in settings.py there was a setting:
GRAPPELLI_INDEX_DASHBOARD = "the_app.dashboard.AdminDashboard"
I found the AdminDashboard class and sure enough, in there, is a definition of what models appear on the 'dashboard' of the admin site.