2011年5月4日 星期三

create Bookmark model to connect with user

1.add Bookmark model on models.py

from django.db import models
from django.contrib.auth.models import User

# Create your models here.
class Link( models.Model ):
url = models.URLField( unique = True )

class Bookmark( models.Model ):
title = models.CharField( max_length = 200 )
user = models.ForeignKey( User )
link = models.ForeignKey( Link )

2.sync db with python manage.py
#python manage syncdb

沒有留言:

張貼留言