![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=1739545286-r9F5vsVhlufAD5wOliXgqzHDyRZn5orS-0-40bab6177b6f935d9be4188ccca5fb14)
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=1739545286-ofUc9ljb38YGysI5Zei7ah8l1O6Tp2pc-0-f12ca53f7b8f64d1e520346fd550e056)
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=1739545286-s0FA8PJ0frLkI9cFzBxjaOx3GQrO3Luq-0-d3794f58e5932c306319789ac99895a7)