Django model layout with multiple columns - django

My admin page for a specific model has two stackedInlines. Currently they display one under the other. I would like them to display side by side so The page would look like this (don't have enough reputation to embed the image :[ )
Any easy way to go about this without having to write my own admin page?
If that's the only solution, how exactly would I go about that?

you can override Django admin template for each app in your project.
you just have too create same folder as your app in template directory and overriding html.
How to override and extend basic Django admin templates?
You can add CSS/Javascript to admin page by defining class Media.

You'll have to override the admin template to accomplish this. See roshan's answer for more info.

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.

How can i fully customize sidebar_menu in django admin panel?

I don't know any way how can I overright sidebar_menu.html or create some progress to customize it.
so can i get some hits what can i do for coustomize?
You can override many of the templates which the admin module uses to generate the various pages of an admin site. You can even override a few of these templates for a specific app, or a specific model.
Read the Docs of Django. e.g.
Overriding admin templates

Django admin customization (without using themes like jet,suit)

I wish to do some Django admin customization, on which I require the filter panel to be placed at top of the page. Can we also update the other templates as well in some fashion? I have read the official docs for Django admin, but I am unable to implement as I am new to Django and frontend.
You can override and extend the default Django admin template files, and do any sort of changes to the UI, by writing your own admin template files.
As you know, there are several admin themes available for Django, you can go through them, and refer to how these themes are implemented (reading their code) and try making up one for your own as per your needs.
You can read about overriding Django templates -
Already answered question - How to Override and extend basic django admin templates?
Django Documentation - https://docs.djangoproject.com/en/2.0/ref/contrib/admin/#admin-overriding-templates
You can also refer to the following directory on GitHub, which contains all the original Django admin template files, which you can override/extend - https://github.com/django/django/tree/master/django/contrib/admin/templates/admin

Adding Wagtail to an existing Django app

I'm quite new to Django and Wagtail, and I'm having some difficulty with what I think is a very basic use.
How do I allow Wagtail to edit an existing view's template, while serving that template using Django's serving mechanism?
Assume I have an app (HomePage) created to serve the site's main index (/). I have the HomePage's views set up to render template and certain elements dynamically. Now I want that template to be editable via Wagtail's CMS interface. Something as simple as an image on the frontpage, or a headline.
The closest I've gotten so far has been to follow the Wagtail beginner's tutorial to override the base HomePage class in my app's models.py. That only made my pages available via the /pages/ URL.
Thank you for any help.
Since your site's home page is not a Page object in the Wagtail sense, I'd suggest looking at Wagtail's facilities for managing non-page content - snippets and ModelAdmin would be possible candidates, but I reckon the site settings module would be the best fit.
A Setting model gives you a set of fields which can be configured for display in the Wagtail admin using a 'panels' definition, just like you'd get for a page model - with the important property that only one settings record exists per site. You can retrieve this record within your homepage view or template as shown in the docs, and output it on your template as desired.
One way do that, is to let Wagtail serve your homepage. You will need to change your project's url configuration accordingly, to make wagtail's urls serve the root of your site.
Then, you can pack your dynamic content into a custom template_tag and include in your homepage html template.

Admin template for flatpages

I need to plug in reach text editor to admin page of flatpages. And I don't know, what the template are used to falatpages administration?
Update:
One way is to use the django-tinymce app which supports the TinyMCE rich text editor. There's also an example of using the widget with a flatpage form.
Old:
The default template should reside at "flatpages/default.html" but you can customize this through the admin interface. See the Flatpage templates section in the django docs for more information.
In addition to answer to my question. For admin panel of flatpage used default chenge_form.html. But if you customized it for your app, it wouldn't be work for flatpages without explicit destination.