Book Image

Learning Website Development with Django

Book Image

Learning Website Development with Django

Overview of this book

Table of Contents (18 chapters)
Learning Website Development with Django
Credits
About the Author
About the Reviewers
Preface
Index

Summary


With this, we have finished the chapter. We implemented many important features for our application and learned several new Django features. We started by creating a data model for storing tags, and then created a form for bookmark submission. After that, we built pages that allow users to browse and discover new bookmarks.

Here is a quick summary of the Django features mentioned in this chapter:

  • In the data model API, many-to-many relationships are represented with models.ManyToManyField. Django automatically generates attributes to access the items associated with a particular object through this relationship.

  • To customize the string representation of a data model, provide a method called __str__ in the model's class. This method takes no parameters and should return your preferred representation.

  • To customize a form field, supply a custom widget. The widget constructor takes a dictionary of HTML attributes and their values as its parameters.

  • The objects attribute of a data model provides...