Skip to content

Commit 4cdbf6a

Browse files
committed
更新md
更新md
1 parent 5b45207 commit 4cdbf6a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

django_note/编写一个投票web站点.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,3 +246,18 @@ urlpatterns = [
246246

247247
<a href="{% url 'polls:detail' question.id %}">Vote again?</a>
248248
```
249+
### 10.django后台管理系统
250+
#### 创建管理员账号
251+
```python
252+
python manage.py createsuperuser
253+
```
254+
#### 向后台管理系统注册模型
255+
polls/admin.py
256+
```python
257+
from django.contrib import admin
258+
from .models import Question, Choice
259+
260+
admin.site.register(Question)
261+
admin.site.register(Choice)
262+
```
263+
#### 启动web服务,访问127.0.0.1/admin

0 commit comments

Comments
 (0)