I want to do the following:
I want to add a "Refresh" link at the top of the django admin page for a model. How can I do that? I want when people click on Refresh they go to another page that gets data from Google analytics API.
How can I add a link at the top of the admin page for a model? Thanks!
What I tried:
I tried overriding the change_list template for the django admin, but that did not work.
Overriding the change_list template is really your only choice. Did you get errors? or did your content not show up? The hierarchy of your templates directory is directly related to how/where Django looks for templates.
Double check the documentation on overriding admin templates. You may have made a simple mistake: https://docs.djangoproject.com/en/1.4/ref/contrib/admin/#overriding-admin-templates
Related
Basically the admin changelist view has a lot of nice features like sorting, filtering, field list, pagination...
Can I borrow that functionality and use it in my public users site? I was thinking to have class-based view called Cars and borrow all those features from the admin site.
I thought that ModelAdmin would be a place to look, but I have no idea to implement that.
The django-table2 app is more reasonable option for such task than the admin's changelist.
Actually I ended up using django admin for this site instead of developing a public site. Plus on top of this I used django-grappelli to customize the dashboard and make it look like a custom site.
So now I have two admin sites:
1- is the default django/grappelli site that has all the links and functions of the traditional admin site. and this was only used by developers and super users
2- a custom admin site called dashboard that looks more user friendly, and have customized all the look and feel, plus it has the change list, change form of my models so I don't have to rewrite these functions.
and this is how it looks now:
How would I add a rich-text HTML content editor in my Django admin view?
For example, if I want to change the content on my homepage, what python code would I have to input for the HTML to be displayed when I log into the admin portal?
I want to be able to view all of my pages (hopefully even be able to add/delete them), and edit the content directly from the admin view. Similar to something like this:
http://feincms-django-cms.readthedocs.org/en/latest/_images/item_editor_content.png
I appreciate any and all help! Thank you!
The html shown there is there cuz it is in the database. If what you want is a cms, there are several of those for django like django-cms, wagtail, mezzanine among others.
If, on the other hand, you have a model already and want to display it in the admin, you can register it:
from django.contrib import admin
from myproject.myapp.models import Author
class AuthorAdmin(admin.ModelAdmin):
pass
admin.site.register(Author, AuthorAdmin)
In that example, the Author model will show up in admin for edition.
In the last case, where you already have your model registered but you want to have a WYSIWYG editor, check the django-grid for that kind of package and find one suitable, or install one manually.
You have several options in case you want to try the second approach: ckeditor, tinymce, etc.
I am new to Django as well as Python. I am trying to build a Employee management System using django framework.
Till now I was able to build models and show the models in admin module. Now I want to show user a user profile and able to update their details.
I am still in starting phase of the project. What I want to do is, I want show the profile page in the below format i.e similar to admin page look.
But till now I was able to get like below
Is it possible to make profile page of each employee look just like admin page look? which has collapsible options as well
You will need to write your views as well as create you template folder with the relevant template tag.
I believe that is what will get you what you want.
The models you create shows the database columns and rows you want Django to create.
Please check the link below assuming you are using Django 1.6:
https://docs.djangoproject.com/en/1.6/intro/tutorial03/
The collapsible part of Django admin, is made with JavaScript (jQuery) & CSS.
If you want your page to be dynamic, use JavaScript.
If you want to make it more beautiful, use CSS.
Is there any ready apps for django admin, that allows to edit model in popup?
I want next functionallity:
View edit form for model in popup.
On model save - update row in list of models.
Motivation: reduce page reloads.
Also, if there any solutions oriented on massive manual data updates for django? I've taken a look at django grappelli - it improves view of data, but edit data is still not usable.
P.S.: If such kind of app is not available - I'll start open source project.
If you want to open a popup, simply create a link to your 'add' view with the following attribute on that link onclick='return showAddAnotherPopup(this);'
You can do most of what you ask there (at least point 1 and 2) using the django built in admin customisations.
Have a look at https://docs.djangoproject.com/en/dev/ref/contrib/admin/
The django admin itself already uses some things similar to this, pay special attention to the django _popup=1 variable in the request URI.
You will have to add a custom modelname_change_list.html file to provide some javascript and in the ModelAdmin override the delet_view, change_view, response_add and potentially response_change.
I'm using the Django Admin module. It displays a list of models to edit by app. I would like to add another form to this list. It won't edit a specific model, but it will edit settings that are stored in the database. Is this possible?
You may check out Django Live Settings. It was split out of the Satchmo project and looks to do what you're looking for.
Otherwise, you may look into Overriding the Django Admin Templates. You could just override the index template and add your links to the bottom.