[Django] The admin interface
Now let's see how to access admin interface.
1. Create a super user which can access admin interface:
python manage.py createsuperuser
2. Inside admin.py, we import the Models we have defined:
from django.contrib import admin # Register your models here. from .models import List, Card admin.site.register(List) admin.site.register(Card)
---
The models:
from django.db import models from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compatible class List(models.Model): name = models.CharField(max_length=50) def __str__(self): return "List {}".format(self.name) @python_2_unicode_compatible class Card(models.Model): title = models.CharField(max_length=100) description = models.TextField(blank=True) list = models.ForeignKey(List, related_name="cards") story_points = models.IntegerField(null=True, blank=True) business_value = models.IntegerField(null=True, blank=True) def __str__(self): return "Card {}".format(self.title)
Notice that if you change models.py file, you need to run migrations again:
python manage.py makemigrations
If you see the terminal warning that "You have 1 unapplied migration(s)... Run 'python manage.py mifate' to apply then."
python mange.py migrate
3. Run the server:
python manage.py runserver
Go to the url: localhost:8000/admin
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
2016-03-07 [RxJS] Reactive Programming - What is RxJS?
2016-03-07 [CSS3] CSS Display Property: Block, Inline-Block, and Inline
2015-03-07 [Bootstap] 9. Dropdown
2015-03-07 [Bootstrap] 7. Working Herader
2015-03-07 [Bootstrap] 8. 'Collapse', data-target, data-toggle & data-parent
2015-03-07 [AngularJS] Catching errors with $exceptionHandler
2015-03-07 [AngularJS] Taking control of your templates using $templateCache