wagtail customized admin panels - admin

is there a way of customizing my own admin panel , not in terms of styling. What i wish to achieve is a analytics tab , similar to wagalytics . The issue im having with wagalytics is that it is using google analytics , and google analytics is blocked by most adblockers and Mozilla fire fox , making the data really unreliable. As such i wish to utitlize other services like django-analytical to my wagtail administration page with a graph similar to that of wagalytics . However , i have not yet found any resources online that teaches me to override the admin and create my own customized panel (different from the customized tabs here ).
Could someone point me towards the right direction?

To add a page (link) to the Wagtail admin menu, you can use the hook register_admin_menu_item.
Create a file my-app/wagtail_hooks.py and this will be run by Wagtail to hook in custom functionality.
rom django.urls import reverse
from wagtail.core import hooks
from wagtail.admin.menu import MenuItem
#hooks.register('register_admin_menu_item')
def register_frank_menu_item():
return MenuItem('Frank', reverse('name-of-analytics-url'), classnames='icon icon-folder-inverse', order=10000)
You will need to set up the view with whatever reporting/graphs yourself, you could look into the source of wagalytics or simply serve whatever reporting django-analytics makes available.
If you want the templates your view use to extend the Wagtail admin templates, you can do this using the wagtailadmin/base.html. e.g. {% extends "wagtailadmin/base.html" %}. Note: you may need to add 'wagtail.admin', to your INSTALLED_APPS.

Related

Can I access my website from Django admin panel?

I am trying to develop a website where I can see the homepage as it is from Django admin panel. The reason I want that is I want to edit the name of the static content like 'Home' to 'All' along with the change of slide show picture. In summary, I want to change the website layout from Django admin panel that is not accessible to users. Is that possible? I just want an idea of how to implement the process.
Static texts you can change in admin panel with different modules:
for example django-rosetta or my own library Django-tof. https://github.com/wP-soft-GmbH/django-tof
But in your case, i think, you want to made something more.
For this case you can use django-flat-pages, already included in Django, if you have a static web-page.
you can edit every element on the page and after save, you can see it on the front.
if you really want to change the django templates, which you use in your views, you can create a simple template editor in the admin panel based on a widget like django-Ckeditor.

Howto hook or inject code inside orders admin page in openecart

how inject code inside orders admin page in openecart
Iam developing a module in opencart 3 I need away to hook codes (HTML or JavaScript or PHP ) inside admin order page or inside admin orders list page from the module. is that possible ?
in WordPress that is easy , there is a loot of hooks that developers can use , but in open cart i didn't find anything .

How to import a Wagtail page on all the other wagtail pages

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).

Django Admin models that appear in app section, but not on the admin home

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.

Custom Django admin panel

I want to use Django for a web application I'm building that will have an admin panel. I know that you need to just activate the admin app and you're ready to go. However, I would like to have a custom panel, I mean, I want to design the layout myself, I want to add menus and forms for the admin to insert new data in the database etc. Is it possible? or I should write a similar application that will have such features?
For more control over the layout (custom menus etc.) you should check django-admin-tools.
And if you take a look at Django's docs you'll learn that you can easily tweak and override most parts of the admin. For example here is a demonstration on how to use a custom form:
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin
So the admin is pretty customizable. But the question if you should build your own app or reuse the admin depends pretty much on your specific needs. At least make sure you know in which directions the admin can be easily bend.
The sole purpose for Django's admin is to allow you to manipulate (add/edit/remove) data in your database. I think you should at least try to check what the admin is capable of before trying to reinvent the wheel. You'll soon discover the level of complex insight the admin allows you to have. Then you'll discover that making it yourself is unnecessary excess of work and you'll end up with modifying a couple of admin-templates and CSS styles.
Yes, you can customize Django Admin Panel, Django provides some sort of customization for showing database tables structure from their own, for that you can follow DJANGO ADMIN SITE DOC , it will really help you.
For the customizations beyond the Django admin site settings, you can customize admin panel add manual layout, by adding manual detailing in Django template files which are stored in Django environment, django/django/contrib/admin/templates/admin/index.html of your current Django version. You can update its HTML, CSS, and JS according to need.