-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Django 1.0 Website Development

Tags need to be stored in the database and must be associated with bookmarks. So, the first step in introducing tags to our project is creating a data model for tags. A tag object will only hold one piece of data—a string that represents the tag. In addition, we need to maintain a list of tags associated with a particular bookmark. You may recall from Chapter 3 that we used foreign keys to associate bookmarks with users, and called this a one-to-many relationship. However, the relationship between tags and bookmarks is not one-to-many because one tag can be associated with many bookmarks, and one bookmark can also have many tags associated with it. This is called a many-to-many relationship, and is represented in Django models using models.ManyToManyField
.
You should be well aware by now that data models go into the bookmarks/models.py
file, so open the file and add the following Tag
class to it:
class Tag(models.Model): name = models.CharField(max_length=64, unique=True...
Change the font size
Change margin width
Change background colour