Modifying django admin site to accommodate mongodb - python

I have read some posts such as
Django admin site with mongodb
. However, most posts are extremely outdated (like using django 1.3) and links fail to open. So I decided to repost.
I am using django 1.8 and I am trying to make the django admin site display my collections in mongodb just as it would for relational databases. I use mongoengine for ORM so I have classes in models.py to correspond to mongo collections. My mongo collections all have a predefined structure and doesn't contain Listfields that would confuse the django admin site. How should I go about modifying the django admin site to make it accommodate mongodb?

Related

Does the django-rest-framework provide an admin site to manage models?

I'm looking to setup a REST API server with django, and googling suggests this is best done using the django-rest-framework.
The API will return objects stored in a database, and I would also like to be able to add/modify the objects in the database using the django admin site. However, looking at the django-rest-framework documentaion, I see no reference to the admin site (I did find things about "AdminRenderer", but it looked like this isn't what I want).
Simply, does the django admin site exist for a django-rest-framework project?
Simply use the django admin panel provided by django:
Step 1: create superuser
python manage.py createsuperuser
Step 2: run server
python manage.py runserver
Setp 3: Enter the admin site with the newly created credientials
127.0.0.1:8000/admin
Learn more form official documentation:
https://docs.djangoproject.com/en/3.1/intro/tutorial02/#creating-an-admin-user
you can also use the AdminRenderer of django-rest-framework for CRUD operations for using in this purpose as well.
https://www.django-rest-framework.org/api-guide/renderers/#adminrenderer

Python Django: Customize Admin Startpage as analytical Dashboard

I am currently developing a mobile app using Ionic and I am using Django Admin Interface as sort of Backend for adding and editing the content of my mobile app through a MySQL Database.
I currently wish to create a custom analytical dashboard for tracking the usage of the users of my mobile app in the startpage of the Django Admin. While there are some analytical packages for tracking the usage in Django, they only function for web applications.
In my case I need to gather and display aggregate data from my database (Django models & not Django models) as well for other APIs. Is there a way how can I fetch data in form of SQL queries and display them in my dashboard using Python (Django)?
And how can I extend the starting page of Django Admin to a full analytical dashboard with the named functionalities?
I am currently struggling with this as I am new to Django. Any help is much appreciated!
There are some prebuilt admin themes which you can look into, and I personally recommend Django Jet. You can also change directly the way that the admin templates are made and rendered looking around the contrib/admin folder on your Django installation, or you can extend the admin views and templates, take a look at the documentation. Hope I could help!

Django with MongoDB can't get django admin panel?

Is it true that it's a bad choice python with non-relational database like MongoDB ?
I heard if i use mongoDB as my database in my djanog project i can't use default admin panel of django in my projects as it's designed with Relational database m ethology ?
Sure you can use mongoDB with all Django features. Checkout Django non-rel documentation and decide yourself. http://django-mongodb-engine.readthedocs.io/en/latest/

How to show entire existing postgres database in Django admin view

I have an existing PostgreSQL database and I'd like to browse it within Django's admin view. How do you make all the existing tables in a database browsable in Django's admin view?
I tried following the steps here but I was only able to view Groups and Users. I also read that maybe I have to edit admin.py but I'm not sure where that file would be located and what I'd have to put in it.
You need to tell Django which tables you want to browse in the admin view.
To manage database tables Django uses models. Your Django project should be divided into multiple apps and each app has its own modules such as models.py, view.py, admin.py etc.
So if you want to browse all the tables you need to add admin.py files in every app and in each admin.py file add the following lines to register the model with Django's admin.
from django.contrib import admin
from <your_app>.models import <your_model1>, <your_models2>
Now for each model that you imported add.
admin.site.register(<your_model1>)
admin.site.register(<your_model2>)
Please note that only those tables will be visible in Django admin which are managed by Django models. If you do not have a corresponding model for a table in your database you won't be able to view it in the admin.
To know more about the how the admin works read the Django documentation for your version of Django here. Also here is a good tutorial on configuring the admin view in Django.

does GAE support django admin form

I have been leaning Django so I could use the Django admin form in my GAE application. I have just read that GAE doesn't support the django models so i am thinking that it also does not support the admin form.
So the question is does GAE support any other 'forms' or 'reports' environment or do you have to do everything with html
If you're using CloudSQL, django models are supported, and you'll be fine.
If you're using the HRD, getting the admin pages to work would be more difficult.
django models are not supported. The app engine SDK comes with django-style forms that work with the GAE db.Model fields.
Alternatively, you can use django-nonrel which includes a translation layer that allows django models to be used with GAE. The translation layer has various limitations, most prominently, many-to-many relations aren't support. This breaks the Django permissions module which is used by the admin. I've seen some attempts documented to get around this, but I'm not sure how successful people have been.

Categories

Resources