![Django 2 by Example](https://wfqqreader-1252317822.image.myqcloud.com/cover/817/36699817/b_36699817.jpg)
Adding your models to the administration site
Let's add your blog models to the administration site. Edit the admin.py file of your blog application and make it look like this:
from django.contrib import admin
from .models import Post
admin.site.register(Post)
Now, reload the admin site in your browser. You should see your Post model on the admin site, as follows:
![](https://epubservercos.yuewen.com/B99CC2/19470392808882406/epubprivate/OEBPS/Images/Chapter_126.jpg?sign=1739372666-eyQEI1EBpR3iylPDqbJysaSTFwdrWUGW-0-8fb5856a13fb6e085f5a42a6895e786f)
That was easy, right? When you register a model in the Django admin site, you get a user-friendly interface generated by introspecting your models that allows you to list, edit, create, and delete objects in a simple way.
Click on the Add link beside Posts to add a new post. You will note the create form that Django has generated dynamically for your model, as shown in the following screenshot:
![](https://epubservercos.yuewen.com/B99CC2/19470392808882406/epubprivate/OEBPS/Images/Chapter_3.jpg?sign=1739372666-A4BzHJEdIeZxf6QfJo5QfxJMzJWyf79O-0-54961d2a8089f32d3509b33e4ebe81fa)
Django uses different form widgets for each type of field. Even complex fields, such as DateTimeField, are displayed with an easy interface, such as a JavaScript date picker.
Fill in the form and click on the SAVE button. You should be redirected to the post list page with a successful message and the post you just created, as shown in the following screenshot:
![](https://epubservercos.yuewen.com/B99CC2/19470392808882406/epubprivate/OEBPS/Images/Chapter_24.jpg?sign=1739372666-M0R1llffR9Z1vFNGIJ73XfZ4e2T0bGTF-0-31b15c9895ef484c1bc0886243ec07b7)