django 后台管理

修改 admin.py

from myapp.models import *
from django.contrib import admin

# Register your models here.
admin.site.register(Mysite)

修改models

from django.db import models

# Create your models here.
class Mysite(models.Model):
    title=models.CharField(max_length=100)
    url=models.URLField()
    author=models.CharField(max_length=100)
    num=models.IntegerField(max_length=10)

    def __unicode__(self):
        return self.title

    class Meta:
        ordering=['num']

原文地址:https://www.cnblogs.com/yufenghou/p/5470733.html