![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=1738852539-OTzIhNtA95VbjpZkSnhEXBu0WzucqJPW-0-733f7ca628f09d7fb1266a2a2463dad1)
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=1738852539-VbRBm1J8I1diDLCRhFzurocf4UN04djt-0-b119544c700abf0811e3b83b26d90ac8)
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=1738852539-lt5QiPSX0nWIVbU5gQAzD0z7gjrpUOkn-0-1f00c526744ad76ab25c15020da26359)