ディレクトリ構造
tutorial/tutorials
turotial/tutorial
tutorial / settings.py
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
#'domains'
'tutorials'
)
チュートリアル/admin.py
from tutorials.models import Tutorial
from django.contrib import admin
admin.site.register(Tutorial)
# Create your views here.
チュートリアル/models.py
from django.db import models
class Tutorial(models.Model):
name = models.CharField(max_length=200)
url = models.CharField(max_length=200)
def __unicode__(self):
return self.name
class User(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
class Country(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name