So I have setup my django site using the following admin.py:
import models from django.contrib import admin admin.site.register(models.Comment)
which utilizes this models.py:
from django.db import models class Comment(models.Model): text = models.CharField(max_length=400) name = models.CharField(max_length=100) date = models.DateTimeField(auto_now = True) article = models.CharField(max_length=100)
However, after i visit the admin page, it shows the next:
Which usually not so useful. Hitting each link provides me with a webpage with this object's data, but I must have the ability to begin to see the information for every object within this view. I have been searching in the ModelAdmin class at:
but haven't handled to wrap my mind around it. Could it be another model class that should be stored synchronized with my "actual" model? Could it be just an interface by which my Admin site accesses the particular model? Will it do things i want (permitting helpful data to become proven within the admin interface) or will it make a move else?
I am convinced that the Django Admin page should have the ability to replace PHPMyAdmin for doing simple tasks, like browsing the DB and by hand modifying individual objects. Would be that the situation?
Just like it states within the documentation, your model's
ModelAdmin describes the way the admin section will represent your model. It needs to be somewhat synchronized using the actual model, it does not seem sensible that you should display fields that are not present in your model, etc. You appear thinking about the changelist view, that has numerous personalization options (all referred to within the documentation, as well as in the tutorial). An easy start may be:
from django.contrib import admin class CommentAdmin(admin.ModelAdmin): # define which columns displayed in changelist list_display = ('text', 'name', 'date', 'article') # add filtering by date list_filter = ('date',) # add search field search_fields = ['text', 'article'] admin.site.register(Comment, CommentAdmin)
You will find plenty of choices for personalization, of course make reference to the paperwork! Finally, you can certainly utilize it instead of PHPMyAdmin, it is easy to create admin for browsing, modifying object, etc, just how much use you get free from it can be you.